Previously, NGinx worked fine, now this error:

nginx: [error] open() "/var/run/nginx.pid" failed (2: No such file or directory) 

Part of nginx.conf:

 user debian; worker_processes 4; pid /var/run/nginx.pid; 

Previously, everything worked, what happened to him?


from comments:

 $ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: [emerg] open() "/home/user/logs/nginx.access.log" failed (2: No such file or directory) nginx: configuration file /etc/nginx/nginx.conf test failed 
  • sudo nginx -t will analyze the configs and tell you what it doesn't like (if the reason is in the config, of course). - etki
  • nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: [emerg] open () "/home/user/logs/nginx.access.log" failed (2: No such file or directory) nginx: configuration file /etc/nginx/nginx.conf test failed Well, apparently he does not like the fact that you can not open the log. What to do? The main problem is that it cannot find nginx.pid, although everything worked before! - ASaCe
  • @ASaCe, 1. The fact that nginx.pid cannot find is not the main problem, it is its consequences in the form that nginx could not start. The .pid files store just the process ID, no more. 2. For nginx, the inability to open the log is a fatal error. He really cannot reach the file, and therefore refuses to start. To return to normal life, you must either create this folder with the necessary access permissions, or correct the location of the log in the config file. - etki
  • one
    Throw nginx config, then it will be clearer. - Artem
  • one
    @ASaCe, he is looking for including this log, it is quite possible that he found / home / debian, and / home / user is listed in one of the hosts. - etki

2 answers 2

response from comment:

  1. The fact that nginx.pid cannot be found is not the main problem, it is its consequences in the form that nginx could not start. The .pid files store just the process ID, no more.
  2. For nginx, the inability to open the log is a fatal error. He really cannot reach the file, and therefore refuses to start. To return to normal life, you must either create this folder with the necessary access permissions, or correct the location of the log in the config file.

    check nginx is running

     sudo service nginx status 

    If not running

     sudo service nginx start 

    Command to check the configuration

     sudo nginx -t