nginx有很多社区提供的三方的模块提供很多有用的功能,而这些模块由于缺省的方式下并不包含,所以往往需要使用源码进行编译来达到目的,这篇文章以subs_filter为例,首先介绍一下三方模块的确认方法。
subs_filter模块
subs_filter模块用于URL的替换,在进行转发的过程中有较为常见的使用。在配置文件中的设定大体都是这样的:
subs_filter www.待替换的内容 [mirror_host_name];
subs_filter https:// http://;
确认是否包含模块
方法1: 使用nginx -V
[root@liumiaocn nginx]# nginx -V
nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/clien