Solving the PID disappearance problem of Nginx after restarting Linux operating system

Source: Internet
Author: User

After restarting the Linux server, the process of Nginx-s stop after the start of nginx-s Reload, will always report the error nginx: [ERROR] Open () "/alidata/server/nginx/logs/nginx.pid "Failed (2:no such file or directory), this should be because the nginx process killed after the PID is lost, the next time the Nginx-s reload will not start, the reload can solve the problem, but too much trouble.

issued a nginx-s stop and after that I got this error when trying to reload it.

[ERROR]: Invalid PID number "in"/var/run/nginx.pid "

That/var/run/nginx/pid file is empty ATM.

What does I need to fix it?

Nginx-s Reload is the only used-to-tell a running nginx process-to-reload its config. After a stop, you don't have a running nginx process to send a signal to. Just Run Nginx (possibly with a-c/path/to/config/file)

The method is simple:

1. First you have to make sure that the Nginx process is closed (you can close the process by pkill-9 Nginx)

2. Enter your Nginx installation directory inside the CD ' Path/nginx/sbin ' and enter Nginx-c. /conf/nginx.conf can be (sbin directory below an nginx for the launcher,-C for what configuration start, followed by the path of the Nginx configuration file)

Solving the PID disappearance problem of Nginx after restarting Linux operating system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.