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.
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://systransis.cn/yun/39084.html
摘要:基于阿里云,版本是先廢話下進(jìn)程分為進(jìn)程和進(jìn)程,開(kāi)始運(yùn)行后我們可以通過(guò)查看他的的在之后會(huì)把它的進(jìn)程寫(xiě)到文件中。之后就會(huì)把此掉,隨之這個(gè)文件也會(huì)被刪除。此時(shí)你文件得到的一串?dāng)?shù)字和上述中的數(shù)據(jù)是一致的。 基于阿里云,版本是 CentOS release 5.8 (Final) 先廢話下,Nginx進(jìn)程分為master進(jìn)程和worker進(jìn)程,nginx開(kāi)始運(yùn)行后我們可以通過(guò) ps aux|ge...
摘要:客戶請(qǐng)求頭緩沖大小默認(rèn)會(huì)用這個(gè)來(lái)讀取值,如果設(shè)定通過(guò)上傳文件的大小磁盤(pán)和之間互相拷貝數(shù)據(jù)或任意兩個(gè)文件描述符。 環(huán)境說(shuō)明 192.168.1.208 Nginx負(fù)載服務(wù)器 192.168.1.210 webA服務(wù)器 PHP memcache xcache mysql 192.168.1.211 webB服務(wù)器 PHP memcache xcache webA/webB...
摘要:客戶請(qǐng)求頭緩沖大小默認(rèn)會(huì)用這個(gè)來(lái)讀取值,如果設(shè)定通過(guò)上傳文件的大小磁盤(pán)和之間互相拷貝數(shù)據(jù)或任意兩個(gè)文件描述符。 環(huán)境說(shuō)明 192.168.1.208 Nginx負(fù)載服務(wù)器 192.168.1.210 webA服務(wù)器 PHP memcache xcache mysql 192.168.1.211 webB服務(wù)器 PHP memcache xcache webA/webB...
閱讀 3799·2023-01-11 11:02
閱讀 4305·2023-01-11 11:02
閱讀 3127·2023-01-11 11:02
閱讀 5237·2023-01-11 11:02
閱讀 4800·2023-01-11 11:02
閱讀 5573·2023-01-11 11:02
閱讀 5378·2023-01-11 11:02
閱讀 4079·2023-01-11 11:02