安装 nazha 面板 v1
2026/9/6大约 2 分钟
Nezha 总是暴雷,这里只存放当时安装的过程资料。
Dashboard 安装
# 官方安装脚本
curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh访问端口:面板的端口,默认8008。需要使用反代,转发请求至这个端口。
如果使用CDN,那么反代监听的端口就必须是CDN开放的端口。
eg:使用nginx反代
server { listen 2053 ssl http2; listen [::]:2053 ssl http2; server_name rn.535952.xyz; ssl_certificate /root/rn.crt; ssl_certificate_key /root/rn.key;ssl_stapling on; ssl_session_timeout 1d; ssl_session_cache shared:SSL:10m; # 如果与其他配置冲突,请注释此项 ssl_protocols TLSv1.2 TLSv1.3; 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://127.0.0.1:8008; } # 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_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_read_timeout 3600s; proxy_send_timeout 3600s; proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; proxy_max_temp_file_size 0; proxy_pass http://127.0.0.1:8008; } }Agent的通信端口:Agent 与 Dashboard 通信的端口,必需是 Dashboard 的入站端口。
Agent 安装
浏览器访问 Dashboard,在 Dashboard 中登录后台,设置界面中配置 未接入CDN的面板服务器域名/IP 为 Dashboard 所在的服务器。
如果 ip 为ipv6,请加上
[],如[2e80::0]。Dashboard 中添加服务器。
复制 agent脚本,在 agent 端执行。
注意:agent端不需要有公网入站ip,只要能访问 "Dashboard域名/IP : Agent的通信端口" 就行。
可以建立TCP隧道,转发 "Dashboard域名/IP : Agent的通信端口",并在Agent端手动更新Agent配置即可。如 Hax 的 ipv6 to ipv4 tunnel。