• linux下安装nginx


    a、下载安装包

    nginx-1.8.0.tar.gz
    

    b、安装前提环境gcc(已有跳过)

    ①:安装gcc(已有的跳过)
    [root@localhost /]# yum install gcc-c++
    ②:安装pcre库(已有的跳过)
    yum install -y pcre pcre-devel
    ③:安装zlib库(已有的跳过)
    yum install -y zlib zlib-devel
    ④:安装openssl库(已有的跳过)
    yum install -y openssl openssl-devel
    

    c、编译安装

    ①:解压安装包
    
    [root@localhost ~]# tar -zxvf nginx-1.8.0.tar.gz
    [root@localhost ~]#cd nginx-1.8.0
    
    ②:在var下建立temp和nginx文件夹
    
    [root@localhost /var]mkdir temp
    [root@localhost /temp]mkdir nginx
    
    ③:执行configure命令
    [root@localhost nginx-1.8.0]#
    ./configure 
    --prefix=/usr/local/nginx 
    --pid-path=/var/run/nginx/nginx.pid 
    --lock-path=/var/lock/nginx.lock 
    --error-log-path=/var/log/nginx/error.log 
    --http-log-path=/var/log/nginx/access.log 
    --with-http_gzip_static_module 
    --http-client-body-temp-path=/var/temp/nginx/client 
    --http-proxy-temp-path=/var/temp/nginx/proxy 
    --http-fastcgi-temp-path=/var/temp/nginx/fastcgi 
    --http-uwsgi-temp-path=/var/temp/nginx/uwsgi 
    --http-scgi-temp-path=/var/temp/nginx/scgi
    
    ④:编译
    [root@localhost nginx-1.8.0]# make
    [root@localhost nginx-1.8.0]# make install
    
    至此安装完毕…………

    d、启动nginx

    ①:启动nginx
    [root@localhost sbin]# ./nginx
    
    ②:查看nginx进程
    [root@localhost sbin]# ps aux | grep nginx

    e、停止nginx

    ①:快速停止(不建议使用)
    [root@localhost nginx]# cd /usr/local/nginx/sbin/
    [root@localhost sbin]# ./nginx -s stop
    
    ②:完整停止(建议使用)
    [root@localhost nginx]# cd /usr/local/nginx/sbin/
    [root@localhost sbin]# ./nginx -s quit
    

    f、重启nginx

    方式一:先停止再启动(建议启动)
    [root@localhost sbin]# ./nginx -s quit
    [root@localhost sbin]# ./nginx
    
    方式二:重新加载配置文件(修改配置文件后常使用)
    [root@localhost sbin]# ./nginx -s reload

    至此结束,后续回详细介绍nginx的使用

    关注我的公众号,精彩内容不能错过

  • 相关阅读:
    Spiral Matrix
    Merge Intervals
    Edit Distance
    Insertion Sort List
    Add Binary
    Partition List
    Binary Tree Postorder Traversal
    单向链表反转
    Facebook Hacker cup Qualification round Problem 1
    判断二叉树是否为平衡二叉树
  • 原文地址:https://www.cnblogs.com/huanchupkblog/p/5543327.html
Copyright © 2020-2023  润新知