zoukankan      html  css  js  c++  java
  • nginx开机启动

    原文地址

    1.在/etc/init.d/下面建一个名叫nginx的文件

    #! /bin/sh
    #chkconfig: 2345 80 90
    #description:auto_run
    
    set -e
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    DESC="nginx daemon"
    NAME=nginx
    DAEMON=/usr/local/nginx/sbin/$NAME
    SCRIPTNAME=/etc/init.d/$NAME
    
    test -x $DAEMON || exit 0
    
    d_start(){
            $DAEMON || echo -n " already running"
    }
    
    d_stop(){
            $DAEMON -s quit || echo -n " not running"
    }
    
    d_reload(){
            $DAEMON -s reload || echo -n " could not reload"
    }
    
    d_check(){
            $DAEMON -t|| echo -n " could not check config"
    }
    case $1 in
    start)
            echo -n "Starting $DESC: $NAME"
                    d_start
                    echo "."
    ;;
    stop)
            echo -n "Stopping $DESC: $NAME"
                    d_stop
                    echo "."
    ;;
    reload)
            echo -n "Reloading $DESC: configuration..."
                    d_reload
            echo "reloaded."
    ;;
    check)
            echo -n "Checking $DESC: checking..."
                    d_check
            echo "checked."
    ;;
    restart)
            echo -n "Restarting $DESC: $NAME"
                    d_stop
            sleep 2
            d_start
            echo "."
    ;;
    *)
            echo "Usage:$SCRIPTNAME {start|stop|restart|reload}"
            exit 3
    ;;
    esac
    
    exit 0
    

    2.授权脚本可执行chmod +x /etc/init.d/nginx

    3.命令启动service nginx start/etc.init.d/nginx start

    4.自启动

    Ubuntu:update-rc.d -f nginx defaults
    CentOS:chkconfig  --add nginx
            chkconfig  --list nginx
  • 相关阅读:
    struts1.X的jar包
    struts2.1.6所需jar包详解
    hibernate的运行原理
    hibernate的save()方法详解
    flash的动态加载技术
    havok之内存管理
    worker中加载本地文件报错的解决方案
    行为树之我见
    havok之thread和memory system
    havok之collision detection
  • 原文地址:https://www.cnblogs.com/xqhppt/p/4937829.html
Copyright © 2011-2022 走看看