The nginx server keeps reporting the following error when the server is shut down and restarted:
[root@localhost sbin]# nginx: [emerg] open() "/var/run/nginx/nginx.pid" failed (2: No such file or directory)
Solution:
/> /local/nginx/conf/
cd /usr/local/nginx/conf/
- Edit the configuration file nginx.conf
vi nginx.conf
- The following code is commented in the configuration file:
#pid logs/nginx.pid;
- removes the comment, i.e. #, and changes it to the following code:
pid /usr/local/nginx/logs/nginx.pid;
- Press ESC, enter the following code, save and exit
:wq
- > create logs directory in /usr/local/nginx:
[root@localhost conf]# mkdir /usr/local/nginx/logs
- Start the nginx service:
/usr/local/nginx/sbin/nginx
Pro test successful!
Read More:
- Nginx startup error: nginx: [error] open() “/ var / run / nginx/ nginx.pid The solution of “failed (2: no such file or directory)”
- nginx: [error] open() "/var/run/nginx/nginx.pid" failed (2: No such file or directory)
- nginx: [error] open() “/usr/local/var/run/nginx.pid” failed (2: No such file or directory)
- nginx: open() “/var/run/nginx.pid“ failed (2: No such file or directory)
- nginx: [error] open() “/usr/local/nginx/logs/nginx.pid“ failed (2: No such file or directory)
- nginx: [error] open() “/run/nginx.pid” failed (2: No such file or directory)
- nginx: [error] invalid PID number in /var/run/nginx.pid
- CentOS7 nginx Failed to read PID from file /run/nginx.pid: Invalid argument?
- Nginx error: nginx: [error] invalid PID number “” in “/run/nginx.pid”
- nginx: [error] invalid PID number ““ in “/data/nginx/logs/nginx.pid“
- Solve the problem of starting nginx nginx.pid error
- Ubuntu error: flAbsPath on /var/lib/dpkg/status failed – realpath (2: No such file or directory)
- Nginx start error: job for nginx.service failed because the control process exited with error code
- Solve the problem of copy failed: stat / var / lib / docker / TMP / docker builder 455335933 / opt: no such file or directory
- Error: enoent: no such file or directory, stat ‘/ usr / local / var / www / / book/gitbook/git
- Error: enoent: no such file or directory, stat ‘/ usr / local / var / www / /_ book/gitbook/git
- Plug in loaded: fastmirror, langpacks / var / run/ yum.pid Locked, another program with PID 2323 is running
- Error “/run/lvm/lvmetad.socket: connect failed: No such file or directory” – but not Grub related
- Cannot run program “cd“: error=2, No such file or directory
- Ubuntu 20.04 builds nginx 1.18.0 and MAC file transfer / download to server