<div class="htmledit_views" id="content_views">html
<p>在使用的阿里云服务器上,进程性的 nginx -s stop后再次启动nginx -s reload ,老是会报错误nginx: [error] open() "/alidata/server/nginx/logs/nginx.pid" failed (2: No such file or directory),这应该是由于把nginx进程杀死后pid丢失了,下一次再开启nginx -s reload时没法启动,重装能够解决这个问题,可是太麻烦了。</p> <p>一开始百度解决该问题。只是找到几个求助答案。没有实际有效的方法,因而用google开始搜索,虽然英语比较恶心,但通常,英文网站上总会有解决方法这一次也不另外。</p> <p><br></p> <p> issued a nginx -s stop and after that I got this error when trying to reload it.<br><br> [error]: invalid PID number "" in "/var/run/nginx.pid"<br><br> That /var/run/nginx/pid file is empty atm.<br><br> What do I need to do to fix it?</p> <p><br></p> <p>nginx -s reload is 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)</p> <p>因而我用了这方法,也就是nginx -c /path/to/config/file) //在我机器上是这样的/alidata/server/nginx/sbin/nginx -c /alidata/server/nginx/conf/nginx.conf</p> <p><br></p> <p><br></p> <p>但愿能够帮助到你们,还有就是搞计算机真他妈应该学好英语啊。<br></p> </div> <p><h3>最终解决方案:</h3></p> ```java sudo nginx -c /etc/nginx/nginx.con ```java