Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nginx dynamically adds modules to the installed nginx

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Here, take the installation of the third-party NGX _ http_google_filter_module module as an example

The module of nginx needs to recompile nginx instead of referencing .so in the configuration file like apache.

1. Download the third-party expansion module ngx_http_google_filter_module

# cd / data/software/ # git clone https://github.com/cuber/ngx_http_google_filter_module

two。 See which modules are installed when nginx is compiled and installed

Change the command line to the directory where the nginx executor is located and type. / nginx-V, as follows:

[root@liuyazhuang121 sbin] #. / nginx- V nginx version: nginx/1.9.3 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) built with OpenSSL 1.0.2 22 Jan 2015 TLS SNI support enabled configure arguments:-- prefix=/usr/local/nginx-1.9.3-- with-openssl=/usr/local/src/openssl-1.0.2-- with-pcre=/usr/local/src/pcre-8.37-- with -zlib=/usr/local/src/zlib-1.2.8-- with-http_ssl_module [root@liuyazhuang121 sbin] #

You can see that the compilation installation uses these parameters-- prefix=/usr/local/nginx-1.9.3-- with-openssl=/usr/local/src/openssl-1.0.2-- with-pcre=/usr/local/src/pcre-8.37-- with-zlib=/usr/local/src/zlib-1.2.8-- with-http_ssl_module.

3. Add modules that need to be installed and recompile

Add-- add-module=/data/software/ngx_http_google_filter_module here

The details are as follows:

The copy code is as follows:

/ configure-- prefix=/usr/local/nginx-1.9.3-- with-openssl=/usr/local/src/openssl-1.0.2-- with-pcre=/usr/local/src/pcre-8.37-- with-zlib=/usr/local/src/zlib-1.2.8-- with-http_ssl_module-- add-module=/data/software/ngx_http_google_filter_module

As above, add all the parameters that previously installed Nginx, and finally add-- add-module=/data/software/ngx_http_google_filter_module

After that, we will compile as follows:

# make / / do not make install, or you will really overwrite it

4. Replace nginx binaries

# backup the original nginx executor # cp / usr/local/nginx-1.9.3/sbin/nginx / usr/local/nginx-1.9.3/sbin/nginx.bak # copy the newly compiled nginx executor to the / usr/local/nginx/sbin/ directory # cp / opt/nginx/nginx / usr/local/nginx/sbin/

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report