zoukankan      html  css  js  c++  java
  • 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
     
     
  • 相关阅读:
    QT窗体程序设置成不可改变大小,并生成在Linux下可双击执行的程序文件
    QT新建一个窗口控制程序,以实现添加按钮点击弹出信息提示框为例
    C# 模拟Http请求、下载
    thingsboard改造使用mysql数据库
    Redis单机版分布式锁实现
    利用jvisualvm使用btrace进行线上调试案例
    Btrace官方教程-中文版
    Powerdesigner16 逆向 postgresql9.2
    Linux java进程无故被kill
    thingsboard填坑之路
  • 原文地址:https://www.cnblogs.com/cpw6/p/11636364.html
Copyright © 2011-2022 走看看