Kaspa HTTP代理配置示例
作者:未知 来源:kastop.com 发布时间:2024年11月17日 点击数:
HTTP 代理可用于将流量路由到 Kaspa p2p 节点。当您想将 p2p 节点公开到公共 Internet 但不想直接公开节点时,这非常有用。这可以通过使用 NGINX 或 HAProxy 等 HTTP 代理来完成。
代理还允许您将多个节点映射到不同的子域或路径。当您在同一台计算机上运行多个网络时,这可能很有用。
NGINX 浏览器
以下是根据路径将流量路由到不同 Kaspa p2p 节点的 NGINX 配置示例:
server {
listen 80;
listen [::]:80;
# Replace example.com with your domain
server_name *.example.com;
client_max_body_size 1m;
# Kaspa p2p node (kaspa-mainnet)
location /kaspa/mainnet/wrpc/borsh {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://127.0.0.1:17110/;
}
# Kaspa p2p node (kaspa-mainnet)
location /kaspa/mainnet/wrpc/json {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://127.0.0.1:18110/;
}
# Kaspa p2p node (kaspa-testnet-10)
location /kaspa/testnet-10/wrpc/borsh {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://127.0.0.1:17210/;
}
# Kaspa p2p node (kaspa-testnet-10)
location /kaspa/testnet-10/wrpc/json {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://127.0.0.1:18210/;
}
# Kaspa p2p node (kaspa-testnet-11)
location /kaspa/testnet-11/wrpc/borsh {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://127.0.0.1:17310/;
}
# Kaspa p2p node (kaspa-testnet-11)
location /kaspa/testnet-11/wrpc/json {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://127.0.0.1:18310/;
}
}
使用 NGINX 的注意事项
默认 NGINX 配置允许每个 CPU 内核同时有 768 个连接。如果需要增加此限制,可以通过修改文件中的指令来实现。worker_connections
nginx.conf
感动 | 同情 | 无聊 | 愤怒 | 搞笑 | 难过 | 高兴 | 路过 |
相关文章
-
没有相关内容