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

Nginx: [error] open() “/var/run/nginx/” failed (2: No such file or directory)
Cause of the problem:
The 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:
(1) to CD/usr/local/nginx/conf/directory, edit the configuration file nginx. Conf.
#pid logs/; #pid logs/;

(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: