• 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

    至此,开机启动配置完成

  • 相关阅读:
    一、用Delphi10.3模拟读取百度网页,并读取相关头部信息
    计算机语言发展史
    VMware workstation 14 安装 iOS虚拟机
    mysql-1
    linux网页资料链接
    Ubuntu常用命令大全
    搭建yum源
    CentOS7安装iptables防火墙
    nginx 第二课
    交换机
  • 原文地址:https://www.cnblogs.com/bury12/p/8048175.html
Copyright © 2020-2023  润新知