nginx启动及检测nginx配置是否正确

检查配置文件:

/data/app/nginx/sbin/nginx -t
nginx: [emerg] invalid number of arguments in "root" directive in /data/app/nginx/conf/nginx.conf:58
nginx: configuration file /data/app/nginx/conf/nginx.conf test failed

上面的结果说明nginx.conf:58行有问题

启动nginx
nginx的sbin目录下  运行./nginx
ps -ef|grep nginx后显示

root     28775     1  0 18:24 ?        00:00:00 nginx: master process ./nginx
nobody   28776 28775  0 18:24 ?        00:00:00 nginx: worker process
nobody   28777 28775  0 18:24 ?        00:00:00 nginx: worker process
nobody   28778 28775  0 18:24 ?        00:00:00 nginx: worker process
nobody   28779 28775  0 18:24 ?        00:00:00 nginx: worker process
nobody   28780 28775  0 18:24 ?        00:00:00 nginx: worker process
nobody   28781 28775  0 18:24 ?        00:00:00 nginx: worker process
nobody   28782 28775  0 18:24 ?        00:00:00 nginx: worker process
nobody   28783 28775  0 18:24 ?        00:00:00 nginx: worker process

说明正常启动。

重启命令:
./nginx -s reload




service nginx start
service nginx stop
service nginx restart
service nginx reload

/etc/init.d/nginx start
/etc/init.d/nginx stop
/etc/init.d/nginx restart
/etc/init.d/nginx reload

参考: http://ydlmlh.iteye.com/blog/1747367

Nginx在centos linux安装、部署完整步骤并测试通过
http://www.2cto.com/os/201407/314601.html

猜你喜欢

转载自rd-030.iteye.com/blog/2356372
今日推荐