Home > Operation and Maintenance > Nginx > How to add new module to nginx?

How to add new module to nginx?

青灯夜游
Release: 2019-06-13 18:22:20
Original
8679 people have browsed it

How to add new module to nginx?

Steps to add a new module to nginx:

1. Download the module


git clone https://github.com/agentzh/echo-nginx-module
Copy after login

2. Put it into the specified location


mv echo-nginx-module-master /usr/local/src/nginx-1.8.1/echo-nginx-module
Copy after login

3. View the compiled parameters


/usr/local/nginx/sbin/nginx -V
Copy after login

The result is:

--user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6
Copy after login

4. Recompile


./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --add-module=/usr/local/src/nginx-1.8.1/echo-nginx-module --with-ipv6 
make
Copy after login

PS: Only make is required here, be sure not to execute make install, otherwise it will overwrite

5. Backup Original file


cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
Copy after login

6. Replace nginx binary file


cp /usr/local/src/nginx-1.8.1/objs/nginx /usr/local/nginx/sbin/nginx
Copy after login

7. Check and smoothly start nginx


ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx(做软链,添加到环境变量)
nginx -t (检测配置文件)
nginx -s reload (平滑重启)
Copy after login

The above is the detailed content of How to add new module 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