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

  • 相关阅读:
    递归
    递归
    递归
    San Francisco Crime Classification非数值性多分类问题
    kaggle入门题Titanic
    二叉树的前序,中序,后序,层序遍历的递归和非递归实现
    排序算法总结
    [LeetCode]148. Sort List链表归并排序
    [LeetCode]141. Linked List Cycle判断循环链表
    [leetcode]61. Rotate List反转链表k个节点
  • 原文地址:https://www.cnblogs.com/Vampire-MIn/p/13073429.html
Copyright © 2011-2022 走看看