2025/07/30

宝塔+哪吒探针V1面板VPS批量管理监控

 

 原生IP注册  ,  高速IP购买  ,  指纹浏览器 , 中转加速降低延迟 , 泰国高速VPS , 东南亚VPS推荐 

一.更新系统安装组建

cloudflare设置(域名设置)

设计域名,打开小云朵;网路——打开gRPC和WebSockets;SSL设置 完全;申请一个15年的证书(这个自选,后期也可用宝塔申请,但宝塔续签证书偶尔会抽风)

#安装wget,sudo等

apt install -y curl wget sudo unzip

#升级系统

apt update -y && apt install wget curl sudo unzip git -y

#Docker-compose安装

curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

#给docker-compose赋予运行权限

chmod +x /usr/local/bin/docker-compose

#安装 unzip 工具

Debian/Ubuntu 系统(APT 包管理器):

sudo apt update && sudo apt install unzip -y

CentOS/RHEL 系统(YUM 包管理器):

sudo yum install unzip -y

Alpine 系统(APK 包管理器):

sudo apk add unzip

二.安装宝塔面板

#安装宝塔

curl -sSL https://www.aapanel.com/script/install_6.0_en.sh -o install_6.0_en.sh && bash install_6.0_en.sh aapanel

#安装docker(如果这步没安装,后面执行宝塔安装脚本的时候也会自动安装)

curl -fsSL https://get.docker.com | bash -s docker

#宝塔登录设置保存

1.保存宝塔登录账号密码:

aaPanel Internet Address: https://154.21.89.15:34194/fcccb892

aaPanel Internal Address: https://154.21.89.15:34194/fcccb892

username: ******

password: ******

三.安装哪吒面板

哪吒官方:https://nezha.wiki/guide/dashboard.html

安装 Dashboard面板

外国机,用以下代码

curl -L https://raw.githubusercontent.com/nezhahq/scripts/refs/heads/main/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh

国内机,用以下代码

curl -L https://gitee.com/naibahq/scripts/raw/main/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh

请输入站点标题: - 自定义你的站点标题(自行设置)。

请输入暴露端口: - 公开访问端口(可直接默认 8008,回车就行)。

请指定安装命令中预设的 nezha-agent 连接地址: - Agent对接地址【域名/IP:端口】(此处设置为 by.dafdjgh5545g.top:443)。

是否希望通过 TLS 连接 agent : Agent 通信使用 TLS 连接(选 y)。

请指定后台语言: - 选择语言偏好。

安装完后,可以先用你的ip:8008就能访问了。如果没问题,我就进行下一步

四.宝塔面板设置

只安装Nginx 1.24.0

网站添加站点:静态解开

3.打开配置文件

打开配置文件菜单,在最后面填上以下代码,然后点保存:(如果在安装哪吒监控时,你自定义了端口,把下面代码中的8008改为你自定义的端口)

upstream dashboard {
    keepalive 512; 
    server 127.0.0.1:8008; 
}

4.打开方向代理

打开反向代理 —— 添加反向代理,127.0.01:8008,保存.

5.配置方向代理

全部替换

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"; 
}

underscores_in_headers on;
set_real_ip_from 0.0.0.0/0; # CDN 回源 IP 地址段
real_ip_header CF-Connecting-IP; # CDN 私有 header,此处为 CloudFlare 默认

# gRPC 服务
location ^~ /proto.NezhaService/ {
    grpc_set_header Host $host;
    grpc_set_header nz-realip $http_CF_Connecting_IP; 
    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; 
    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;
}

5.SSL证书设置

五.哪吒面板设置

修改账号密码

默认:admin

修改真实IP请求头

到这里,你就能用域名访问你的面板了。先记得改密码,然后设置,因为面板和 agent 都开启了 CF CDN,我们需要在面板系统设置里面的真实 IP 请求头填写

CF-Connecting-IP

3.后台的登录 IP 以及其它地方才能正常显示真实 IP

4.添加服务监控

上海电信 sh.telecom.818198.xyz:80

上海移动 sh.mobile.818198.xyz:80

广东移动 gz.mobile.818198.xyz:80

广州电信 gz.telecom.818198.xyz:80

厦门电信 202.101.103.55

全国DNS:https://www.nodeseek.com/post-82748-1

六.卸载Agent端(监控客户端)

1.停止并禁用服务

systemctl stop nezha-agent
systemctl disable nezha-agent

2.删除Agent文件

删除Agent安装目录:

rm -rf /opt/nezha/agent

移除systemd服务文件:

rm /etc/systemd/system/nezha-agent.service

重新加载systemd配置:

systemctl daemon-reload

七.Agent监控客户端安装失败

#强制终止占用锁的进程

sudo kill -9 17044    # 强制终止进程(替换为实际PID)
sudo rm /var/lib/dpkg/lock-frontend  # 删除前端锁文件
sudo rm /var/lib/dpkg/lock           # 删除后端锁文件(如有)

#修复包管理器状态

sudo dpkg --configure -a   # 修复未完成的配置
sudo apt install -f        # 修复依赖关系

其他

 原生IP注册  ,  高速IP购买  ,  指纹浏览器 , 中转加速降低延迟 , 泰国高速VPS , 东南亚VPS推荐