Home > Article > Backend Development > Nginx method to dynamically add modules to installed nginx_nginx
This article mainly introduces the method of Nginx to dynamically add modules to installed nginx. The editor thinks it is quite good, so I will share it with you now and give it as a reference. Let’s follow the editor and take a look.
Instructions:
Nginx has been installed, but you need to add a module that has not been compiled and installed. What should you do? Woolen cloth?
Specific:
Here is taking the installation of the third-party ngx_http_google_filter_module module as an example
nginx module requires recompiling nginx. Instead of configuring file references like apache.so
1. Download the third-party extension module ngx_http_google_filter_module
# cd /data/software/ # git clone https://github.com/cuber/ngx_http_google_filter_module
2. View nginx Which modules are installed during compilation and installation
# nginx -V nginx version: nginx/1.8.0 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013 TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --add-module=/data/software/ngx_http_substitutions_filter_module
It can be seen that --prefix=/usr/local/nginx --with-http_ssl_module -- with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --add-module=/data/software/ngx_http_substitutions_filter_module these parameters. --add-module=/data/software/ngx_http_substitutions_filter_module is added when compiling and adding the ngx_http_substitutions_filter_module module before.
3. Add the modules that need to be installed and recompile, as here add –add-module=/data /software/ngx_http_google_filter_module
# ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --add-module=/data/software/ngx_http_substitutions_filter_module --add-module=/data/software/ngx_http_google_filter_module # make //千万不要make install,不然就真的覆盖了
4. Replace nginx binary file:
# cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak # cp ./objs/nginx /usr/local/nginx/sbin/
Related Recommended:
Summary and sharing of nginx related knowledge points
nginx reverse proxy mechanism solves front-end cross-domain problems
The above is the detailed content of Nginx method to dynamically add modules to installed nginx_nginx. For more information, please follow other related articles on the PHP Chinese website!