Nginx已安装的情况下添加新模块

在已安装的Nginx上添加新模块,首先检查已有的模块,通过`./sbin/nginx-V`。然后查看可安装模块,使用`./configure--help`。添加模块如http_ssl_module,使用`./configure`指定参数并重新编译,只运行`make`,不执行`makeinstall`。最后备份原有Nginx二进制文件并替换。
摘要由CSDN通过智能技术生成

Nginx已安装的情况下添加新模块

  • 查看已经安装的模块有哪些:./sbin/nginx -V
  • 去源码包,查看可以安装的模块:./configure --help, 列出 --with-XXX的都是没有安装的,–withoutXX都是已经安装的
  • 配置添加新的模块/删除就的模块:./configure --prefix=/opt/software/middleware/nginx-install-1.22.1 --with-http_ssl_module --with-http_stub_status_module --with-http_image_filter_module
  • 编译: make , 注意这里只用make ,不要再 make install
  • 备份,覆盖
[root@localhost nginx-install-1.22.1]# 
[root@localhost nginx-install-1.22.1]# pwd
/opt/software/middleware/nginx-install-1.22.1
[root@localhost nginx-install-1.22.1]# ./sbin/nginx -V
nginx version: nginx/1.22.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
configure arguments: --prefix=/opt/software/middleware/nginx-install-1.22.1 
[root@localhost nginx-1.22.1]# 
[root@localhost nginx-1.22.1]# pwd
/opt/software/middleware/nginx-1.22.1
[root@localhost nginx-1.22.1]# ./configure --help | grep --with-http
grep: unrecognized option '--with-http'
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
[root@localhost nginx-1.22.1]# ./configure --help | grep with-http
  --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=dynamic
  --with-http_geoip_module           enable ngx_http_geoip_module
  --with-http_geoip_module=dynamic   enable dynamic ngx_http_geoip_module
  --with-http_sub_module             enable ngx_http_sub_module
  --with-http_dav_module             enable ngx_http_dav_module
  --with-http_flv_module             enable ngx_http_flv_module
  --with-http_mp4_module             enable ngx_http_mp4_module
................

[root@localhost nginx-1.22.1]# ./configure --prefix=/opt/software/middleware/nginx-install-1.22.1  --with-http_ssl_module --with-http_stub_status_module --with-http_image_filter_module
checking for OS
 + Linux 3.10.0-862.el7.x86_64 x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
checking for gcc -pipe switch ... found
checking for -Wl,-E switch ... found
.................
[root@localhost nginx-1.22.1]# 
[root@localhost nginx-1.22.1]# make
make -f objs/Makefile
make[1]: Entering directory `/opt/software/middleware/nginx-1.22.1'
cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
	-o objs/src/core/nginx.o \
	src/core/nginx.c
.............
.............
[root@localhost nginx-1.22.1]# 
[root@localhost nginx-1.22.1]# cp /opt/software/middleware/nginx-install-1.22.1/sbin/nginx  /opt/software/middleware/nginx-install-1.22.1/sbin/nginx.back-20230405
[root@localhost nginx-1.22.1]# 
[root@localhost objs]# cp nginx /opt/software/middleware/nginx-install-1.22.1/sbin/
cp: overwrite ‘/opt/software/middleware/nginx-install-1.22.1/sbin/nginx’? y
[root@localhost objs]# 

参考资料

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值