1.查询Nginx配置参数
作用:一是检查所需模块是否已安装,二是将configure arguments: 后面的参数复制出来并保存,因为等会重新编译时还需将这些模块一同添加进去。
[root@reader ~]# nginx -V
nginx version: nginx/1.24.0
built by gcc 8.5.0 20210514 (Red Hat 8.5.0-4) (GCC)
built with OpenSSL 1.1.1k FIPS 25 Mar 2021
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-threads --with-http_ssl_module --with-http_gzip_static_module
[root@reader ~]#
2.清除历史编译
进入Nginx源码包目录下,执行make clean指令,清除历史编译。
[root@reader conf]# cd /usr/soft/nginx-1.24.0/
[root@reader nginx-1.24.0]# make clean
rm -rf Makefile objs
[root@reader nginx-1.24.0]#
3.添加所需模块
使用./configure --help指令查询需要配置的参数。
[root@reader nginx-1.24.0]# ./configure --help
--help print this message
--prefix=PATH set installation prefix
--sbin-path=PATH set nginx binary pathname
--modules-path=PATH set modules path
--conf-path=PATH set nginx.conf pathname
--error-log-path=PATH set error log pathname
--pid-path=PATH set nginx.pid pathname
--lock-path=PATH set nginx.lock pathname
--user=USER set non-privileged user for
worker processes
--group=GROUP set non-privileged group for
worker processes
--build=NAME set build name
--builddir=DIR set build directory
--with-select_module enable select module
--without-select_module disable select module
--with-poll_module enable poll module
--without-poll_module disable poll module
--with-threads enable thread pool support
--with-file-aio enable file AIO support
--with-http_ssl_module enable ngx_http_ssl_module
--with-http_v2_module enable ngx_http_v2_module
--with-http_realip_module enable ngx_http_realip_module
--with-http_addition_module enable ngx_http_addition_module
--with-http_xslt_module enable ngx_http_xslt_module
--with-http_xslt_module=dynamic enable dynamic ngx_http_xslt_module
--with-http_image_filter_module enable ngx_http_image_filter_module
--with-http_image_filter_module=d