Solve the problem of CWP7 Monit monitoring error: nginx Connection failed in monit
CWP7 solves the problem of nginx Connection failed in monit error
When Chen Weiliang installed the Monit monitoring software on the CWP control panel (CWP7) last time, he solved the problem that the Monit startup monitoring process disappeared. monit.service failed.
Now I encounter a new problem-Monit fails to monitor the Nginx connection...
How to solve nginx Connection failed in monit?
Methods to solve the problem of nginx Connection failed in monit error:
First, SSH enter 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 timeout
Restart Monit monitoring program▼
systemctl restart monit.service
View Monit monitoring program▼
systemctl status monit.service
If this step is reached, an 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 monitor program status▼
systemctl status monit.service
The problem of nginx Connection failed in monit is finally solved!
Hope Chen Weiliang blog (
https://www.chenweiliang.com/ ) shared "CWP7 to solve the problem of nginx Connection failed in monit error", it is helpful to you.
Welcome to share the link of this article:
https://www.chenweiliang.com/cwl-1423.html