不能启动的表现: /usr/local/app/nginx/sbin/nginx -s reload nginx: [error] open() “/usr/local/app/nginx/logs/nginx.pid” failed (2: No such file or directory)解决:
sudo mkdir /usr/local/var/run
this error can occurs when nginx try to initialise pid file in localisation that doesn’t exist.
/usr/local/app/nginx/sbin/nginx -c /usr/local/app/nginx/conf/nginx.conf
使用service nginx start: 需要添加一个脚本: /etc/init.d/nginx 然后nginx配置中启用nginx的daemon on 再chkconfig nginx on,开机自动启动; 或者 echo “service nginx start ”>>/etc/rc.local (这是使用者自订开机启动程序)