nginx的编译安装

 运维   大苹果   2024-01-19 22:56   109

nginx的编译安装

  • pcre依赖下载

    pcre-8.45.zip

  • nginx安装包下载

    nginx-1.24.0.tar.gz

  • 安装

    tar -zxvf nginx-1.24.0.tar.gz
    unzip pcre-8.45.zip
    yum install zlib zlib-devel openssl openssl-devel pcre-devel -y
    
    cd nginx-1.24.0
    
    ./configure \
        --prefix=/usr/local/nginx \
        --sbin-path=/usr/local/nginx/sbin/nginx \
        --conf-path=/usr/local/nginx/conf/nginx.conf \
        --pid-path=/usr/local/nginx/nginx.pid \
        --with-http_ssl_module \
        --with-zlib= \
        --error-log-path=/usr/local/nginx/error/error.log \
        --http-log-path=/usr/local/nginx/error/http.log \
        --user=www \
        --group=root \
        --lock-path=/var/lock/nginx.lock \
        --with-http_ssl_module \
        --with-http_flv_module \
        --with-http_stub_status_module \
        --with-http_gzip_static_module \
        --http-client-body-temp-path=/var/tmp/nginx/client/ \
        --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
        --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
        --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
        --http-scgi-temp-path=/var/tmp/nginx/scgi \
        --with-stream \
        --with-pcre=../pcre-8.40
    
  • nginx启动命令

    /usr/local/nginx/sbin/nginx
    
  • 配置检测

    /usr/local/nginx/sbin/nginx -t
    
  • 重启

    /usr/local/nginx/sbin/nginx -s reload