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

文章目录 「隐藏」
  1. 如何解决nginx Connection failed in monit?

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

上次陈沩亮在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错误问题》留言数:0

    发表留言