搭建哪吒探针
Gitee OAuth设置
登录Gitee,找到第三方应用,申请一个Client ID和Client Secret,保留下来备用。
面板安装
官方安装脚本
curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh
境内服务器使用:
curl -L https://cdn.jsdelivr.net/gh/naiba/nezha@master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh
客户端安装
访问面板
http://example.com:8008
点击右上角登录,使用Gitee账户登录,进入后台
以Linux系统为例,先点击添加服务器,设置好信息,然后点击绿色小企鹅,复制一键安装客户端命令,在客户机上粘贴执行即可
命令格式为:curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh install_agent b.com 5555 [Password]
配置Nginx反代
将面板机的8008端口反代到http://example.com/
需要按实际情况修改下列信息
server_name a.com; # 面板域名
ssl_certificate /etc/nezha/server.crt; # 你的域名证书路径
ssl_certificate_key /etc/nezha/server.key; # 你的域名私钥路径
nginx配置:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 1024;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
gzip on;
access_log /root/nginx.log;
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name a.com;
ssl_certificate /etc/nezha/server.crt; # 你的域名证书路径
ssl_certificate_key /etc/nezha/server.key; # 你的域名私钥路径
underscores_in_headers on;
location / {
proxy_pass http://127.0.0.1:8008;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
}
location ~ ^/(ws|terminal/.+)$ {
proxy_pass http://127.0.0.1:8008;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
}
}
server {
listen 80;
location /.well-known/ {
root /var/www/html;
}
location / {
rewrite ^(.*)$ https://$host$1 permanent;
}
}
}
最后
可以根据自己实际配置CDN、SSL。 记住!被控端的面板通讯IP不可以套CDN!建议直接用面板服务器的IP!
搭建哪吒探针
http://localhost:8090//archives/202405061454