转移nezha哪吒探针面板
date
May 24, 2022
slug
tip-nezha-dashboard-migration
status
Published
summary
小技巧
tags
tip
type
Post
URL
Problem & SummarySolution在 旧机上停止面板/opt/nezha 传到 新机上新机 - 重启面板改域名确保upstream upgrade大问题是有些客户端需要手动重启才行docker-compose.ymldata/config.yml
Problem & Summary
Solution


在 旧机上停止面板
curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh stop_dashboard

/opt/nezha 传到 新机上
# in both machines
sudo apt-get install rsync
rsync -e 'ssh -p 22022' -ahzP --delete /opt/nezha/ root@bwh2g2t.xxx.com:/opt/nezha
新机 - 重启面板
curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh restart_and_update

改域名



确保upstream upgrade

#PROXY-START/
location ~* \.(php|jsp|cgi|asp|aspx)$
{
proxy_pass http://127.0.0.1:9100;
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;
}
location /
{
proxy_pass http://127.0.0.1:9100;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
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;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
add_header Cache-Control no-cache;
expires 12h;
}
location /ws
{
proxy_pass http://127.0.0.1:9100;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
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;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
add_header Cache-Control no-cache;
expires 12h;
}
#PROXY-END/
大问题是有些客户端需要手动重启才行
curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh restart_agent
docker-compose.yml
version: "3.3"
services:
dashboard:
image: ghcr.io/naiba/nezha-dashboard
container_name: nezha-server
restart: always
volumes:
- ./data:/dashboard/data
ports:
- 9100:80
- 9101:9101
- 5555:9101
networks:
default:
name: npm_nginx_proxy_manager-network
external: true
data/config.yml
debug: false
language: zh-CN
site:
brand: H1 Machines
cookiename: nezha-dashboard
theme: hotaru
customcode: ""
viewpassword: xxxxxxxx
oauth2:
type: github
admin: adminxxxx
clientid: 4c006e5d473xxxx
clientsecret: f6aa9959a8bxxxx
httpport: 80
grpcport: 9101
grpchost: nezhadirect.xxx.com
proxygrpcport: 0
tls: false
enableplainipinnotification: false
enableipchangenotification: false
ipchangenotificationtag: default
cover: 0
ignoredipnotification: ""
ignoredipnotificationserverids: {}