Compile the Nginx source code and install the subs_filter module.
When using nginx's reverse proxy function to build a bkjia backup storage, you must replace the string with the response content of the official bkjia server. For example, you can replace www.bkjia.com with the backup storage host name and https: // Replace with http ://. Nginx does not have the built-in function. A third-party module, such as subs_filter, must be used.
Configuring the module in nginx is not as simple as apache (copying the module File and modifying the configuration file). You need to introduce the module source code to the nginx source code, compile nginx and install it on your own.
The following describes how to compile and install nginx that contains the subs_filter module on CentOS.
0) If nginx is not installed on centos, install it with yum. Some initial nginx configuration files, such as/etc/rc, will be automatically added during yum installation. d/init. d/nginx,/etc/nginx. conf (these configuration files are not added during self-compilation and installation ).
Yum install nginx
1) from the # Source Releases part of the http://wiki.nginx.org/Install to get the nginx Source code, download and unzip.
Wget http://nginx.org/download/nginx-1.8.0.tar.gz
Tar xf nginx-1.8.0.tar.gz
2) git checks out the source code of subs_filter (refer to nginx_substitutions_filter ).
Git clone git: // github.com/yaoweiin/ngx_http_substitutions_filter_module.git
(Note: The save path is/git/ngx_http_substitutions_filter_module)
3) nginx compilation Configuration
. /Configure -- prefix =/usr/share/nginx -- sbin-path =/usr/sbin/nginx -- conf-path =/etc/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/client_body -- http-proxy-temp-path =/var/lib/nginx/tmp/ proxy -- http-fastcgi-temp-path =/var/lib/nginx/tmp/fastcgi -- http-uwsgi-temp-path =/var/lib/nginx/tmp/uwsgi -- http-scgi-temp-path =/var/lib/nginx/tmp/scgi -- pid-path =/run/nginx. pid -- lock-path =/run/lock/subsys/nginx -- user = nginx -- group = nginx -- with-file-aio -- with-ipv6 -- with-http_ssl_module -- with-http_spdy_module -- with-http_realip_module -- with-http_addition_module -- with-http_sub_module -- -- with-http_gunzip_module -- with-http_gzip_static_module -- with-http_random_index_module -- with-http_secure_link_module -- with-http_degradation_module -- add-module =/git/ngx_http_substitutions_filter_module
The last -- add-module is the introduced subs_filter module.
4) Compile and install nginx
Make & make install
5) Configure subs_filter in/etc/nginx. config.
Server {
Listen 80;
Listen [:]: 80;
Server_name [cmd_host_name];
Location /{
Proxy_pass
Build a WEB server using Nginx
Build a Web server based on Linux6.3 + Nginx1.2 + PHP5 + MySQL5.5
Performance Tuning for Nginx in CentOS 6.3
Configure Nginx to load the ngx_pagespeed module in CentOS 6.3
Install and configure Nginx + Pcre + php-fpm in CentOS 6.4
Nginx installation and configuration instructions
Nginx log filtering using ngx_log_if does not record specific logs
Nginx details: click here
Nginx: click here
This article permanently updates the link address: