zoukankan      html  css  js  c++  java
  • linux下配置nginx使用service nginx start 服务

    解压出来后执行

    mkdir /var/tmp/nginx/client/ -pv

    接下来我们简单的为它提供一个服务脚本吧!

    # vim  /etc/init.d/nginx

    新建文件/etc/rc.d/init.d/nginx,内容如下:

    #!/bin/bash

    # chkconfig:235 85 15

    # description: Nginx is an HTTP server

    . /etc/rc.d/init.d/functions

    start() {

            echo "Start..."

            /usr/local/nginx/sbin/nginx &> /dev/null

            if [ $? -eq 0 ];then

                    echo "Start successful!"

            else

                    echo "Start failed!"

            fi

    }

    stop() {

            if killproc nginx -QUIT ;then

                    echo "Stopping..."

            fi

    }

    restart() {

            stop

            sleep 1

            start

    }

    reload() {

            killproc nginx -HUP

            echo "Reloading..."

    }

    configtest() {

            /usr/local/nginx/sbin/nginx -t

    }

    case $1 in

    start)

            start ;;

    stop)

            stop ;;

    restart)

            restart ;;

    reload)

            reload ;;

    configtest)

            configtest ;;

    *)

            echo "Usage: nginx {start|stop|restart|reload|configtest}"

            ;;

    esac

    之后给这个文件可执行权限:

    # chmod  +x  /etc/init.d/nginx

    现在可以使用 start,stop 这些参数控制Nginx服务了

  • 相关阅读:
    全景转换工具
    Leetcode 215.数组中的第k个最大元素
    Leetcode 214.最短回文串
    Leetcode 213.大家劫舍II
    Leetcode 212.单词搜索II
    Leetcode 211.添加与搜索单词
    Leetcode 209.长度最小的子数组
    Leetcode 208.实现前缀树
    Leetcode 207.课程表
    Leetcode 206.反转链表
  • 原文地址:https://www.cnblogs.com/xuexin/p/6208094.html
Copyright © 2011-2022 走看看