Nginx startup error: nginx: [error] open() “/ var / run / nginx/ nginx.pid The solution of “failed (2: no such file or directory)”

Question:
Nginx: [error] open() “/var/run/nginx/nginx.pid” failed (2: No such file or directory)
Cause of the problem:
The nginx.pid file cannot be found in /var/run/nginx/. There are two ways to do this:
The default directory is /var/run/nginx/.
The second way: Modify the nginx.conf file to specify the directory where the PID file resides. Let’s demonstrate the second way. As follows:
Solution:
(1) to CD/usr/local/nginx/conf/directory, edit the configuration file nginx. Conf.
#pid logs/nginx.pid; #pid logs/nginx.pid;

(3) the annotation, go out and amended as: pid/usr/local/nginx/logs/nginx pid;

Mkdir /usr/local/nginx/logs = ‘/usr/local/nginx/logs’
CD /usr/local/nginx/sbin/ CD /usr/local/nginx/sbin


Read More: