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

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]# 

参考资料

  • 如何在已经安装好的Nginx上增加新模块

你可能感兴趣的:(java,nginx,运维,服务器)