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

你可能感兴趣的:(nginx)