Solve nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed error

After logging in to the server , go to nginx and use ./nginx -s reload to reread the configuration file, and find that nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory) error, go to the logs file and find that there is indeed no nginx.pid file

 
[root@localhost sbin]# ./nginx -s reload
nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)
 
Solution:
[root@localhost nginx]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
 
Use the nginx -c parameter to specify the location of the nginx.conf file
 
[root@localhost nginx]# cd logs/
[root@localhost logs]# ll
Total dosage 12
-rw-r--r-- 1 root root 1246 12月  9 18:10 access.log
-rw-r--r-- 1 root root  516 12月 10 15:39 error.log
-rw-r--r-- 1 root root    5 12月 10 15:38 nginx.pid
 
See that the nginx.pid file already exists.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324525753&siteId=291194637