zoukankan      html  css  js  c++  java
  • centOS下安装nginx

    1、安装pcre-8.41

      tar -xvf pcre-8.4.1.tar.gz

      cd pcre-8.4.1

      ./configure

      make && make install

    2、安装zlib-1.2.11

    3、安装nginx

      tar -xvf nginx-1.12.2.tar.gz

      cd nginx-1.12.2

      ./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-pcre=../pcre-8.41 --with-zlib=../zlib-1.2.11

      make && make install

    4、nginx开机自启动

    4.1 vim /etc/init.d/nginx  (红色两行一定要添加)

    #! /bin/sh

     

    # chkconfig: - 85 15
    # description: nginx is a World Wide Web server. It is used to serve

    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

    DESC="nginx daemon"
    NAME=nginx
    DAEMON=/usr/local/nginx/$NAME
    CONFIGFILE=/usr/local/nginx/$NAME.conf
    PIDFILE=/usr/local/nginx/$NAME.pid
    SCRIPTNAME=/etc/init.d/$NAME

    set -e
    [ -x "$DAEMON" ] || exit 0

    do_start() {
    $DAEMON -c $CONFIGFILE || echo -n "nginx already running"
    }

    do_stop() {
    kill -INT `cat $PIDFILE` || echo -n "nginx not running"
    }

    do_reload() {
    kill -HUP `cat $PIDFILE` || echo -n "nginx can't reload"
    }

    case "$1" in
    start)
    echo -n "Starting $DESC: $NAME"
    do_start
    echo "."
    ;;
    stop)
    echo -n "Stopping $DESC: $NAME"
    do_stop
    echo "."
    ;;
    reload|graceful)
    echo -n "Reloading $DESC configuration..."
    do_reload
    echo "."
    ;;
    restart)
    echo -n "Restarting $DESC: $NAME"
    do_stop
    do_start
    echo "."
    ;;
    *)
    echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2
    exit 3
    ;;
    esac

    exit 0

        chkconfig --add nginx

     chkconfig nginx on

    至此,开机启动配置完成

  • 相关阅读:
    发球
    Java学习笔记
    驼峰式命名法
    公式编辑测试
    Python3.5 在Ubuntu16.04上无法画图的解决方案
    Ubuntu16.04 安装flash player
    Spring切面通知执行的顺序(Advice Order)
    修改别人写的利用AOP实现日志监控的问题
    传感器系列之4.10 酒精传感器
    传感器系列之4.8光敏传感器
  • 原文地址:https://www.cnblogs.com/bury12/p/8048175.html
Copyright © 2011-2022 走看看