Many people are accustomed to start a Nginx web server through init scripts and then they can control the state of the server through service command, such as sudo service nginx restart. But sometimes unobvious config error makes the scripts failed to work. Here I will show an error related to pid directive in the config file of nginx, which defaultly located at /opt/nginx/conf/nginx.conf.
As ignored by many people, some init scripts assump there is a pid file of nginx located at /var/run/nginx.pid, but in the fact, the default pid file for nginx is /opt/nginx/logs/nginx.pid. Because the scripts can"t get the correct pid or even get nothing, they failed to stop the nginx process, some tasks dependent on it will be failed too, for example, you are not able to restart the server.
To resolve this problem, you need to:
Force terminating your server through:
$ sudo service nginx destroy
Open your nginx config file to edit:
$ sudo vim /opt/nginx/conf/nginx.conf
Specify the path of your pid file:
# /opt/nginx/conf/nginx.conf pid /var/run/nginx.pid
After saving your change, start your server now:
$ sudo service nginx start
To confirm that your pid config has taken effect, you can cat your pid file and/or try to restart your server through service command:
$ cat /var/run/nginx.pid $ sudo service nginx restart
As expected, you will see the screen out "OK" for your operations.
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/39084.html
摘要:基于阿里云,版本是先廢話下進程分為進程和進程,開始運行后我們可以通過查看他的的在之后會把它的進程寫到文件中。之后就會把此掉,隨之這個文件也會被刪除。此時你文件得到的一串數字和上述中的數據是一致的。 基于阿里云,版本是 CentOS release 5.8 (Final) 先廢話下,Nginx進程分為master進程和worker進程,nginx開始運行后我們可以通過 ps aux|ge...
摘要:客戶請求頭緩沖大小默認會用這個來讀取值,如果設定通過上傳文件的大小磁盤和之間互相拷貝數據或任意兩個文件描述符。 環境說明 192.168.1.208 Nginx負載服務器 192.168.1.210 webA服務器 PHP memcache xcache mysql 192.168.1.211 webB服務器 PHP memcache xcache webA/webB...
摘要:客戶請求頭緩沖大小默認會用這個來讀取值,如果設定通過上傳文件的大小磁盤和之間互相拷貝數據或任意兩個文件描述符。 環境說明 192.168.1.208 Nginx負載服務器 192.168.1.210 webA服務器 PHP memcache xcache mysql 192.168.1.211 webB服務器 PHP memcache xcache webA/webB...
閱讀 3735·2023-01-11 11:02
閱讀 4244·2023-01-11 11:02
閱讀 3050·2023-01-11 11:02
閱讀 5181·2023-01-11 11:02
閱讀 4738·2023-01-11 11:02
閱讀 5534·2023-01-11 11:02
閱讀 5313·2023-01-11 11:02
閱讀 3990·2023-01-11 11:02