本次编译使用在鲲鹏920arm架构服务器上编译nginx1.20版本的nginx服务,使用的主要模块有nginx-push-stream-module、nginx-upload-progress-module、ngx_cache_purge、ngx_devel_kit、ngx_http_substitutions_filter_module、ngx-fancyindex
下载nginx和对应模块源码包
#下载1.20.1nginx源码包
wget http://nginx.org/download/nginx-1.20.1.tar.gz
在nginx维基上https://www.nginx.com/resources/wiki/search/下载对应使用的模块,放到 /var/www/nginx-1.20.0/build/ 目录中
编译安装nginx模块
使用如下的编译参数
/configure --with-cc=/usr/bin/gcc \
--with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' \
--with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--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 \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--with-debug --with-pcre-jit \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-http_auth_request_module \
--with-http_addition_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_geoip_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_image_filter_module \
--with-http_mp4_module \
--with-http_perl_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_v2_module \
--with-http_sub_module \
--with-mail \
--with-mail_ssl_module \
--with-stream \
--with-stream_ssl_module \
--with-threads \
--add-module=/var/www/nginx-1.20.0/build/nginx-push-stream-module \
--add-module=/var/www/nginx-1.20.0/build/nginx-upload-progress-module \
--add-module=/var/www/nginx-1.20.0/build/ngx_cache_purge \
--add-module=/var/www/nginx-1.20.0/build/ngx_devel_kit \
--add-module=/var/www/nginx-1.20.0/build/ngx_http_substitutions_filter_module \
--add-module=/var/www/nginx-1.20.0/build/ngx-fancyindex --with-http_xslt_module
执行完之后
make;make install