[root@lnmp ~]# vim /etc/init.d/nginx
修改其中的:
21
22 nginx="/usr/local/nginx/nginx" #自身机子nginx启动路径
23 prog=$(basename $nginx)
24
25
26 NGINX_CONF_FILE="/usr/local/nginx/nginx.conf" #自身机子conf路径
[root@lnmp ~]# chkconfig --add nginx #设置脚本随机启动
[root@lnmp ~]# chmod +x /etc/init.d/nginx #赋予启动运行的权限
[root@lnmp ~]# /etc/init.d/nginx status
nginx is stopped #查看nginx
状态
[root@lnmp ~]# /etc/init.d/nginx start #启动nginx
Starting nginx: [ OK ]
[root@lnmp ~]# service nginx stop #nginx停止
Stopping nginx: [ OK ]
[root@lnmp ~]# service nginx start #启动nginx
Starting nginx: [ OK ]
本文转自 yawei555 51CTO博客,原文链接:http://blog.51cto.com/huwei555/1623255,如需转载请自行联系原作者