CWP7 solves the problem of nginx Connection failed in monit error

Troubleshooting CWP7 Monit monitoring errors: nginx Connection failed in monitoring

CWP7 solves the problem of nginx Connection failed in monit error

Last time, when Chen Weiliang installed the Monit monitoring software in the CWP control panel (CWP7) , he resolved the issue of the Monit monitoring process disappearing upon startup (monit.service failed).

Now I have a new problem - Monit monitoring Nginx connection failed...

How to solve nginx Connection failed in monit?

The method to solve the nginx Connection failed in monit error problem:

First, SSH into the following command ▼

ps -ef|grep nginx

Found the nginx configuration file:

[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

Open the nginx configuration file :

/etc/nginx/nginx.conf

Found the path location of nginx.pid:

pid /var/run/nginx.pid;

In the configuration file of the Monit monitoring program, enter the following configuration for monitoring 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

Restart the Monit monitoring program▼

systemctl restart monit.service

View Monit monitoring program status▼

systemctl status monit.service

If this step is reached, the error message still appears:nginx Connection failed in monit

Please try to modify the port number of the monitoring nginx configuration to "8181" or "80":

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

Then, restart the Monit monitoring program▼

systemctl restart monit.service

View Monit monitoring program status▼

systemctl status monit.service

The problem of nginx Connection failed in monit is finally solved!

Comment

Your email address will not be published. Required fields are marked with * .

Scroll to Top