linux操作系统重启后 解决nginx的pid消失问题

重启了linux服务器之后,进程性的 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时无法启动,重装可以解决这个问题,但是太麻烦了。

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 do I need to do to fix it?

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)

方法很简单:

1.首先你要先确保关闭nginx进程了(可以通过pkill -9 nginx关闭进程)

2.进入你nginx的安装目录里面 cd 路径/nginx/sbin里面(这里要注意路径问题哦!!!) 然后输入

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 就可以了(sbin目录下面有个nginx为启动程序,-c为以什么配置启动,后面接着nginx配置文件的路径)

清零日志

服务器空间小,使用到90%多了,查看了下,把该清理的清理。网站日志好久不看,一看几个G,需要清理。

echo > /home/wwwlogs/access.log

给flash添加A链接的代码

    <!--此处添加链接-->
<a href="url" target="_blank" style="text-decoration:none">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" 
width="192" height="136">            
        <param name="movie" value="fla/xxx.swf"><!--此处添加flash-->
        <param name="quality" value="high">
        <!--此处添加flash-->
        <embed src="fla/xxx.swf" quality="high" 
            pluginspage="http://www.macromedia.com/go/getflashplayer" 
            type="application/x-shockwave-flash" width="192" height="136"></embed>
</object></a>

参考:http://www.cnblogs.com/dudumao/p/3599486.html (感谢)