宝塔面板搭建哪吒面板,一个便携服务器状态监控面板搭建教程
开始之前,请先确定你搭建探针的域名 强烈建议用两个(子)域名做解析 第一个是面板的域名,套CDN比较方便 第二个仅仅解析到面板服务器的域名,用于客户端连接服务端试用(这个可以没有,但是不建议,如果直接用IP的话,迁移面板后会非常麻烦!)
比如我的TZ.CHENXX.CN作为面板的域名,还有一个TZ.CHENXX.CN(可以不同)是用来记录面板服务器的IP(其实不是这个域名,因为我写出来就暴露了我的IP了,所以就当它是吧 暂且将两个域名都解析到部署面板服务器的IP。
2.1 得到GitHub账号ID
如果没有Github账号,先注册
浏览器中打开HTTPS://API.GITHUB.COM/USERS/你的GITHUB用户名
返回的是Json的信息,第二行id对应的值就是你的ID,纯数字的。如图


2.2 创建一个OAuth Apps
先打开:https://github.com/settings/developers,然后点击New OAuth App按钮

填入域名信息,将域名更换为自己的
[prism lang=""]
http://tz.chenxx.cn:8008
http://tz.chenxx.cn:8008/oauth2/callback
[/prism]

2.3 OAuth Apps的Client ID和Client secrets
Click ID 如图下

新建Client secrets,

获得Client secrets,记住Client secrets,只有一次机会。

3.1 防火墙放行端口
需要放行8008、5555两个端口,这是默认的,如果你程序中改为其他的,防火墙放行相应的端口
3.2 部署面板服务
哪吒面板开发者提供了一键脚本
海外:
[prism lang=""]curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh sudo ./nezha.sh[/prism]
国内加速:
[prism lang=""]curl -L https://raw.sevencdn.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh sudo ./nezha.sh[/prism]
输入命令后如图


按1进行安装面板,
接着就要输入前面记录下来的GITHUB账号ID、OAUTHAPP的CLIENT ID
、OAUTHAPP的CLIENT SECRETS 按照提示输入

到这里面板服务算是完成了大部分了
可以访问http://域名:8008
查看,用你的GitHub账号验证登录
3.3 反代、SSL、CDN
反代配置
[prism lang=""]location / { proxy_pass http://127.0.0.1:8008; proxy_set_header Host $host; } location /ws { 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 $host; }[/prism]
图为宝塔面板操作反向代理


配置SSL就不用说了,常规建站的配置。
配置完SSL,就可以通过HTTPS://域名/来访问了。
返回:https://github.com/settings/developers
修改如图
更改为https访问,并取消8008端口,因为已经被反代了。


访问https://tz.chenxx.cn到页面并登陆后台。
到服务器页面添加服务器


会生成一个节点服务器的专属id与密钥
到需要被监控的机器执行脚本
海外:
[prism lang=""]curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh sudo ./nezha.sh[/prism]
国内加速:
[prism lang=""]curl -L https://raw.sevencdn.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh sudo ./nezha.sh[/prism]
按8进行安装监控Agent,
按照提示输入
解析到面板IP的域名地址、面板RPC端口(默认5555)、服务器AGENT ID、服务器AGENT 密钥

有多台被监控机器时,按照此步骤在控制面板添加服务器,在被监控机执行脚本填写ID和密钥。