Nginx Startup Error: “/var/run/nginx/nginx.pid” failed” [How to Solve]

problem:

  After restarting the virtual machine, restarting nginx again will report an error: open() “/var/run/nginx/nginx.pid” failed (2: No such file or directory)

Solution:

  (1) Enter the cd /usr/local/nginx/conf/ directory and edit the configuration file nginx.conf;

  (2) There is a comment in the configuration file: #pid logs/nginx.pid;

 (3) Release the comment and modify it to: pid /usr/local/nginx/logs/nginx.pid;

  (4) Create a logs directory under the /usr/local/nginx directory: mkdir /usr/local/nginx/logs

  (5) Start nginx service: /usr/local/nginx/sbin/nginx

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *