2020年9月13日星期日

CWP7解决nginx Connection failed in monit错误问题

原文链接:https://www.chenweiliang.com/cwl-1423.html

解决CWP7 Monit监控错误问题:nginx Connection failed in monit


https://img.chenweiliang.com/2020/09/monit-connection.jpg


上次陈沩亮CWP控制面板(CWP7)安装Monit监控软件时,解决了Monit启动监控进程消失monit.service failed.


现在又遇到新问题——Monit监控Nginx连接失败……


如何解决nginx Connection failed in monit?


解决nginx Connection failed in monit错误问题的方法:


首先,SSH输入以下命令 ▼


ps -ef|grep nginx

找到了nginx的配置文件:


[root@ten ~]# ps -ef|grep nginx
root 11550 1 0 02:12 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nobody 11551 11550 0 02:12 ? 00:00:04 nginx: worker process
nobody 11552 11550 0 02:12 ? 00:00:08 nginx: worker process
nobody 11553 11550 0 02:12 ? 00:00:02 nginx: worker process
nobody 11554 11550 0 02:12 ? 00:00:01 nginx: worker process
nobody 11555 11550 0 02:12 ? 00:00:00 nginx: cache manager process
root 19827 9820 0 02:37 pts/0 00:00:00 grep --color=auto nginx

打开nginx的配置文件


/etc/nginx/nginx.conf

找到了nginx.pid的路径位置:


pid /var/run/nginx.pid;

在Monit监控程序的配置文件里,输入以下监控nginx的配置 ▼


check process nginx with pidfile /var/run/nginx.pid
start program "/usr/bin/systemctl start nginx.service"
stop program "/usr/bin/systemctl stop nginx.service"
if failed port 8181 protocol http then restart
if 4 restarts within 8 cycles then timeoutif 4 restarts within 8 cycles then timeout

重启Monit监控程序 ▼


systemctl restart monit.service

查看Monit监控程序状态 ▼


systemctl status monit.service

若到此步骤,还是出现错误提示:nginx Connection failed in monit


请尝试修改监控nginx配置的端口号为“8181”或“80”:


if failed port 8181 protocol http then restart
if failed port 80 protocol http then restart

然后,重启Monit监控程序 ▼


systemctl restart monit.service

查看Monit监控程序状态 ▼


systemctl status monit.service

nginx Connection failed in monit的问题,终于解决了!





欢迎转载《CWP7解决nginx Connection failed in monit错误问题
陈沩亮版权所有,转载请注明出处链接:https://www.chenweiliang.com/cwl-1423.html


网站地址:https://www.chenweiliang.com/



欲获取更多资讯内幕和秘技,欢迎进入Telegram频道:cwlboke

没有评论:

发表评论