zoukankan      html  css  js  c++  java
  • Linux-编译安装Nginx

    编译安装Nginx

    环境:

    Nginx : Nginx-1.12.0               Server : Centos7.6

    安装:

    [root@localhost ~]# yum -y install pcre-devel zlib-devel gcc*

    [root@localhost ~]# useradd -M -s /sbin/nologin nginx

    [root@localhost ~]# tar zxvf nginx-1.12.0.tar.gz

    [root@localhost ~]# cd nginx-1.12.0/

    [root@localhost nginx-1.12.0]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module

    [root@localhost nginx-1.12.0]# make && make install

    [root@localhost nginx-1.12.0]# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/

    创建服务启动脚本:

    #!/bin/bash

    # chkconfig: - 99 20

    # description: Nginx Server Control Script

    PROG="/usr/local/nginx/sbin/nginx"

    PIDF="/usr/local/nginx/logs/nginx.pid"

    case "$1" in

    start)

       $PROG

      ;;

    stop)

      kill -s QUIT $(cat $PIDF)

      ;;

    restart)

      $0 stop

      $0 start

      ;;

    reload)

      kill -s HUP $(cat $PIDF)

      ;;

    status)

      [ -f $PID ] &> /dev/null

           if [ $? -eq 0 ]

              then

              netstat  -anpt | grep nginx

           else

              echo "Nginx is not running."

            fi  

      ;;

    *)

      echo "Usage: $0 {start|stop|restart|reload|status}"

    esac

    exit 0

     

    [root@localhost ~]# chmod +x /etc/init.d/nginx

    [root@localhost ~]# chkconfig --add nginx

    [root@localhost ~]# systemctl status nginx

    [root@localhost ~]# systemctl restart nginx

  • 相关阅读:
    CodeForces
    bzoj 2257: [Jsoi2009]瓶子和燃料
    【NOIP2009】Hankson 的趣味题
    51Nod 1203 JZPLCM
    bzoj 3751: [NOIP2014]解方程
    UOJ #11. 【UTR #1】ydc的大树
    Tenka1 Programmer Contest D
    bzoj 5000: OI树
    bzoj 1407: [Noi2002]Savage
    bzoj 3551: [ONTAK2010]Peaks加强版
  • 原文地址:https://www.cnblogs.com/Vampire-MIn/p/13073429.html
Copyright © 2011-2022 走看看