宝塔 nginx 增加编译模块
找到第 250-300 行之间 ./configure 开头如下字样的配置,我这里是在安装 ngx-fancyindex 模块,所以增加 --add-module=/usr/local/src/ngx-fancyindex:
修改配置文件
vi /www/server/panel/install/nginx.sh找到第 250-300 行之间 ./configure 开头如下字样的配置,我这里是在安装 ngx-fancyindex 模块,所以增加 --add-module=/usr/local/src/ngx-fancyindex:
./configure --add-module=/usr/local/src/ngx-fancyindex --user=www --group=www --prefix=${Setup_Path} ${ENABLE_LUA} --add-module=${Setup_Path}/src/ngx_cache_purge --add-module=${Setup_Path}/src/nginx-sticky-module --with-openssl=${Setup_Path}/src/openssl --with-pcre=pcre-${pcre_version} ${ENABLE_HTTP2} --with-http_stub_status_module --with-http_ssl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt="-Wl,-E" --with-cc-opt="-Wno-error" ${jemallocLD} ${ENABLE_WEBDAV} ${ENABLE_NGX_PAGESPEED} ${ADD_EXTENSION} ${i_make_args}
make -j${cpuCore}重新编译安装
执行以下命令重新编译安装,后面的 2.3.3 是你安装的 nginx 版本号,可通过 nginx -v 查看:
sh /www/server/panel/install/nginx.sh install 2.3.3检查是否正确安装
编译根据你机器配置需要几分钟到十几分钟,编译完后执行 nginx -V 查看,如果包含 --add-module=/usr/local/src/ngx-fancyindex 就是成功了。
Tengine version: Tengine/2.3.3
nginx version: nginx/1.18.0
built by gcc 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
built with OpenSSL 1.1.1m 14 Dec 2021
TLS SNI support enabled
configure arguments: --add-module=/usr/local/src/ngx-fancyindex --user=www --group=www --prefix=/www/server/nginx --add-module=/www/server/nginx/src/ngx_cache_purge --add-module=/www/server/nginx/src/nginx-sticky-module --with-openssl=/www/server/nginx/src/openssl --with-pcre=pcre-8.43 --with-http_v2_module --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_stub_status_module --with-http_ssl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt=-Wl,-E --with-cc-opt=-Wno-error --with-http_dav_module --add-module=/www/server/nginx/src/nginx-dav-ext-module