V1实在是不在我的审美上……
拉取镜像
docker pull ghcr.io/naiba/nezha-dashboard:v0.20.13
创建目录,配置好配置文件
mkdir nezha
cd nezha
touch config.yaml
vi config.yaml
debug: false
httpport: 5566
language: zh-CN
grpcport: 5551
oauth2:
type: "github" #Oauth2 登录接入类型,github/gitlab/jihulab/gitee/gitea
admin: "xxxxxx" #管理员列表,半角逗号隔开,多个用英文逗号隔开
clientid: "xxxxxxx" # 在 https://github.com/settings/developers 创建,无需审核 Callback 填 http(s)://域名或IP/oauth2/callback
clientsecret: "xxxxxxxx"
endpoint: "" # 如gitea自建需要设置
site:
brand: "服务器监控" #站点名称
cookiename: "canxun-dashboard" #浏览器 Cookie 字段名,可不改
theme: "default" #主题
运行容器
docker run -d \
--restart always \
--name nezha \
-p 5566:5566 \
-p 5591:5591 \
-v /root/nezha:/dashboard/data \
ghcr.io/naiba/nezha-dashboard:v0.20.13
配置反向代理
配置域名
添加节点
节点服务器安全设置
vim /etc/systemd/system/nezha-agent.service
在ExecStart= 后加上 --disable-command-execute --disable-force-update
ExecStart=/opt/nezha/agent/nezha-agent "-s" "XXX:XXX" "-p" "XXXX" --disable-command-execute --disable-force-update
重启agent
systemctl daemon-reload
service nezha-agent restart
反向代理 不反代terminal
location ~ ^/(ws)$ {
proxy_pass http://127.0.0.1:5551;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
非宝塔在加一条
location / {
proxy_pass http://127.0.0.1:5551;
proxy_set_header Host $host;
}
安装节点
添加服务器后,海外目前可以直接一键安装,国内服务器目前是连不上
离线安装:
查看自己系统 大多数amd64就行
root@iZ:~# uname -a
Linux Z 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
https://github.com/nezhahq/agent/releases/tag/v0.20.5
上传包
unzip nezha-agent_linux_amd64.zip
mkdir -p /opt/nezha/agent/
mv nezha-agent /opt/nezha/agent/
chmod +x /opt/nezha/agent/nezha-agent
rm -rf nezha-agent_linux_amd64.zip
vi /etc/systemd/system/nezha-agent.service
[Unit]
Description=哪吒探针监控端
ConditionFileIsExecutable=/opt/nezha/agent/nezha-agent
[Service]
StartLimitInterval=5
StartLimitBurst=10
ExecStart=/opt/nezha/agent/nezha-agent "-s" "XXXX:XXXXX" "-p" "XXXXXXXXX" --disable-command-execute --disable-force-update
WorkingDirectory=/root
Restart=always
RestartSec=120
[Install]
WantedBy=multi-user.target
PS:如果位置识别不对 删除EnvironmentFile=-/etc/sysconfig/nezha-agent
systemctl daemon-reload
systemctl enable nezha-agent
systemctl start nezha-agent
评论 (0)