自己在本地搭建的arnbian服务器,用cloudlfare tunnel映射到了公网放在cloudflare托管nazha.test.xyz打开小黄云
使用nginx进行转发
配置如下
哪吒 Agent对接地址【域名/IP:端口】为 nazha.test.xyz:443
proxy_cache_path /www/wwwroot/nazha.test.xyz/proxy_cache_dir levels=1:2 keys_zone=nazha_test_xyz_cache:20m inactive=1d max_size=5g;
server {
listen 80;
listen 443 ssl;
listen 443 quic;
http2 on;
server_name nazha.546321.xyz; # 替换为你的域名
ssl_certificate /www/server/panel/vhost/cert/nazha.test.xyz/fullchain.pem; # 域名证书路径
ssl_certificate_key /www/server/panel/vhost/cert/nazha.test.xyz/privkey.pem; # 域名私钥路径
ssl_stapling on;
ssl_session_timeout 1d;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHE20-draft:EECDH+AES178:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_tickets on;
ssl_session_cache shared:SSL:10m; # 如果与其他配置冲突,请注释此项
ssl_protocols TLSv1.2 TLSv1.3;
include /www/server/panel/vhost/nginx/well-known/nazha.test.xyz.conf;
# underscores_in_headers on;
# set_real_ip_from 0.0.0.0/0; # 替换为你的 CDN 回源 IP 地址段
real_ip_header CF-Connecting-IP; # 替换为你的 CDN 提供的私有 header,此处为 CloudFlare 默认
# 如果你使用nginx作为最外层,把上面两行注释掉
# grpc 相关
location ^~ /proto.NezhaService/ {
grpc_set_header Host $host;
grpc_set_header nz-realip $http_CF_Connecting_IP; # 替换为你的 CDN 提供的私有 header,此处为 CloudFlare 默认
# grpc_set_header nz-realip $remote_addr; # 如果你使用nginx作为最外层,就把上面一行注释掉,启用此行
grpc_read_timeout 600s;
grpc_send_timeout 600s;
grpc_socket_keepalive on;
client_max_body_size 10m;
grpc_buffer_size 4m;
grpc_pass grpc://dashboard;
}
# websocket 相关
location ~* ^/api/v1/ws/(server|terminal|file)(.*)$ {
proxy_set_header Host $host;
proxy_set_header nz-realip $http_cf_connecting_ip; # 替换为你的 CDN 提供的私有 header,此处为 CloudFlare 默认
# proxy_set_header nz-realip $remote_addr; # 如果你使用nginx作为最外层,就把上面一行注释掉,启用此行
proxy_set_header Origin https://$host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
proxy_pass http://127.0.0.1:8008;
}
# web
location ^~ / {
proxy_pass http://127.0.0.1:8008;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header nz-realip $http_cf_connecting_ip;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
proxy_buffer_size 128k;
proxy_buffers 4 128k;
proxy_busy_buffers_size 256k;
proxy_max_temp_file_size 0;
add_header X-Cache $upstream_cache_status;
add_header Cache-Control no-cache;
proxy_ssl_server_name off;
proxy_ssl_name $proxy_host;
add_header Strict-Transport-Security "max-age=31536000";
}
access_log /www/wwwlogs/nazha.test.xyz.log;
error_log /www/wwwlogs/nazha.test.xyz.error.log;
}
upstream dashboard {
server 127.0.0.1:8008;
keepalive 512;
}
现在本地连接不上
用Komari Monitor 不好吗?
8008 端口也暴露出去,443端口换成8008端口试试