首页 📄 WebOps

1 下载安装包

curl -o /tmp/nginx-1.21.0-with-third-module.zip https://oss.iuskye.com/article/2021-08-15/nginx-1.21.0-with-third-module.zip

2 解压并打补丁

cd /tmp
unzip nginx-1.21.0-with-third-module.zip
yum install patch -y
cd nginx-1.21.0/
patch -p1 < ../ngx_http_proxy_connect_module-master/patch/proxy_connect_rewrite_1018.patch

3 编译安装

install_dir=/opt

./configure \
--prefix=${install_dir}/nginx \
--sbin-path=${install_dir}/nginx/sbin/nginx \
--conf-path=${install_dir}/nginx/conf/nginx.conf \
--error-log-path=${install_dir}/nginx/log/error.log \
--http-log-path=${install_dir}/nginx/log/access.log \
--pid-path=${install_dir}/nginx/nginx.pid \
--lock-path=${install_dir}/nginx/nginx.lock \
--user=mbs \
--group=mbs \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--http-client-body-temp-path=${install_dir}/nginx/client/ \
--http-proxy-temp-path=${install_dir}/nginx/proxy/ \
--http-fastcgi-temp-path=${install_dir}/nginx/fcgi/ \
--http-uwsgi-temp-path=${install_dir}/nginx/uwsgi \
--http-scgi-temp-path=${install_dir}/nginx/scgi \
--with-stream \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--with-stream_realip_module \
--with-http_realip_module \
--with-http_gunzip_module \
--with-http_degradation_module \
--with-mail \
--with-mail_ssl_module \
--with-http_slice_module \
--with-threads \
--with-http_addition_module \
--with-http_auth_request_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_v2_module \
--with-http_secure_link_module \
--with-pcre-jit \
--with-http_sub_module \
--with-pcre=/tmp/nginx/pcre-8.37 \
--with-openssl=/tmp/nginx/openssl-1.1.1k \
--with-zlib=/tmp/nginx/zlib-1.2.11 \
--add-module=/tmp/nginx/nginx-upload-module-2.3.0 \
--add-module=/tmp/nginx/nginx_upstream_check_module-master \
--add-module=/tmp/nginx/headers-more-nginx-module-master \
--add-module=/tmp/nginx/ngx_http_proxy_connect_module-master \
--with-debug

cores=$(cat /proc/cpuinfo| grep "processor"| wc -l)
make -j $cores
make install

4 第三方模块展示

tree -L 1 -d
.
├── headers-more-nginx-module-master
├── nginx-1.21.0
├── nginx-upload-module-2.3.0
├── nginx_upstream_check_module-master
├── ngx_http_proxy_connect_module-master
├── openssl-1.1.1k
├── pcre-8.37
└── zlib-1.2.11



文章评论

目录