• Nginx编译安装


     
    1:下载源码包
    [root@ghs etc]# wget http://nginx.org/download/nginx-1.18.0.tar.gz
     
    2:解压和创建nginx用户及安装依赖
    [root@ghs tmp]# tar -zxvf nginx-1.18.0.tar.gz
    [root@ghs tmp]# useradd -s /sbin/nologin -M nginx
    [root@ghs tmp]# yum -y install gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel openssl openssl-devel
     
    3:编译Nginx环境
    [root@ghs nginx-1.18.0]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --with-pcre-jit --with-http_ssl_module --with-http_v2_module --with-http_sub_module --with-stream --with-stream_ssl_module
     
    初始化中出现的错误
    ./configure: error: the HTTP rewrite module requires the PCRE library.
    You can either disable the module by using --without-http_rewrite_module
    option, or install the PCRE library into the system, or build the PCRE library
    statically from the source with nginx by using --with-pcre=<path> option.
    提示错误缺少pcre包
     
    ./configure: error: the HTTP gzip module requires the zlib library.
    You can either disable the module by using --without-http_gzip_module
    option, or install the zlib library into the system, or build the zlib library
    statically from the source with nginx by using --with-zlib=<path> option.
    提示错误缺少zlib-devel包
     
     解决方法
    yum -y install pcre-devel   zlib-devel
     
    [root@ghs nginx-1.18.0]# make
     
    [root@ghs nginx-1.18.0]# make install
     
    4:设置环境变量
    [root@ghs nginx-1.18.0]# vim /etc/profile.d/path.sh
    #!/bin/bash
    export PATH=$PATH:/usr/local/nginx/sbin
     
    [root@ghs nginx-1.18.0]# source !$
     
    5:启动nginx
    [root@ghs nginx-1.18.0]# nginx
    [root@ghs nginx-1.18.0]]# ps aux|grep nginx
    root     16203  0.0  0.0  48960  3300 ?        Ss   Jun01   0:00 nginx: master process nginx
    nobody   18542  0.0  0.2  74712  8324 ?        S    Aug26  22:44 nginx: worker process
    nobody   18543  0.2  0.2  74720  8388 ?        S    Aug26  84:12 nginx: worker process
    root     30071  0.0  0.0 112708   980 pts/0    R+   15:33   0:00 grep --color=auto nginx
     
     
  • 相关阅读:
    python 取整的两种方法
    django class-based view 考古
    django缓存基于类的视图
    MySQL参数优化案例
    django后台使用MySQL情况下的事务控制详解
    讲讲python“=”运算符上的优雅语法
    p标签不折行的问题
    django-TDD
    session 和 flask_session 实现原理(源码解析)
    网关地址和网关IP是什么,他们有什么关系?
  • 原文地址:https://www.cnblogs.com/cpw6/p/11636364.html
Copyright © 2020-2023  润新知