目录#
[[toc]]
服务端安装脚本#
https://nezha.wiki/guide/dashboard.html
go
curl -L https://raw.githubusercontent.com/nezhahq/scripts/refs/heads/main/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh
以 Docker 安装为例,安装完成后按提示输入以下信息:
请输入站点标题:- 自定义站点标题。请输入暴露端口:- 公开访问端口(默认 8008,可自定义)。
{我这里就是 ip:prot}
请指定后台语言:- 选择语言偏好。
【这里的端口既是 web 界面端口,也是 gRPC,websocket的端口】
然后修改密码即可。
客户端配置#
去个人中心进行设置
填写:Agent对接地址【域名/IP:端口】 ,我这里没有开启 tls 连接。
然后回到 服务器端,复制 安装命令。

这个命令去各个 客户端主机 linux 去安装,稍等片刻 便安装好了。
使用cdn进行反代 web 页面#
注意这里的域名不要和上面的域名一样。
安装 nginx
go
sudo apt update
sudo apt install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl status nginx
去 cloudflare 配置 dns,注意开启小黄云开启。
go
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
# http2 on; # Nginx > 1.25.1,请注释上面两行,启用此行
server_name xxxxx.jacin.me; # 替换为你的域名
ssl_certificate /root/fast-proxy/ssl/origin.crt;
ssl_certificate_key /root/fast-proxy/ssl/origin.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://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:xxxx;
}
# 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_set_header X-Forwarded-Proto $scheme; # 如果你使用nginx作为最外层,就启用此行避免无法正确读取访问的协议
proxy_pass http://127.0.0.1:xxxxx;
}
}
upstream dashboard {
server 127.0.0.1:xxxxx;
keepalive 512;
}
只要修改 127.0.0.1:xxx 对应的端口 和 这里的 server_name xxxxx.jacin.me; # 替换为你的域名 域名即可。
重启 nginx ,此时界面就开启了 cdn ,这样访问的时候速度会很快了。
配置 监控服务#
这里 主要以两个为例
一个是 http get 请求

一个是 ping 命令,这个可以看回程延迟。
以北京电信为例。

这里服务就可以开启了:

延迟水平查阅:

评论
还没有评论,来发第一个吧
