How to add modules to Nginx

不言
Release: 2023-04-02 20:30:02
Original
2265 people have browsed it

This article mainly introduces the method of adding modules to Nginx. It has certain reference value. Now I share it with you. Friends in need can refer to

If you have installed Nginx, you need to add a new one. Module, what do I need to do?

Steps

Take the module nginx-sticky-module-ng as an example
  • View the last compilation and installation parameters of Nginx

[~]$ nginx -V
nginx version: nginx/1.10.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) 
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module
Copy after login

In the data output by the command, the configure arguments item is the last compilation parameter and needs to be reused.

  • Back up the original Nginx executable file

  • Download the original version of the Nginx source code package and unzip it

  • Download third-party extension module

git clone https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng.git
Copy after login
  • Add new modules that need to be installed and recompile

If it is a third party If it is a module, specify the directory; if it is a built-in module, specify the module name.

./configure --prefix=/你的安装目录  --add-module=/第三方模块目录
Copy after login
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module --add-module=./nginx-sticky-module-ng

// make后不要执行install,改用手动拷贝
make

// 强制覆盖执行文件
sudo cp -rfp objs/nginx /usr/local/nginx/sbin/nginx
Copy after login

The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

The above is the detailed content of How to add modules to Nginx. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!