分享

CentOS系统设置Nginx服务自动启动运行

 instl 2015-09-16
#!/bin/sh
#chkconfig: 2345 10 90
#name: nginx
#description: Nginx Service Script
#
case $1 in
    start)
                echo  "Starting Nginx..."
        /usr/local/nginx/nginx  -c /usr/local/nginx/nginx.conf
        ;;
    stop)
        echo  "Stopping Nginx..."
        /usr/bin/killall  -s  QUIT  nginx
        ;;
    restart)
                echo  "Reloading Nginx..."
        $0  stop
        $0  start
         ;;
    *)
                echo  "Usage: $0 {start|stop|restart}"
esac
exit  0

配置自启动

chkconfig --level 2345 nginx on

脚本运行后效果如下

 

root@lxhtest html$service nginx stop
Stopping Nginx...
root@lxhtest html$service nginx start
Starting Nginx...
root@lxhtest html$service nginx restart
Reloading Nginx...
Stopping Nginx...
Starting Nginx...

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多