How to recompile Nginx and add modules

How to recompile Nginx and add modules

When compiling and installing Nginx, some modules are not installed by default, such as http_ssl_module. In order for Nginx to support HTTPS, this module must be added.

The following explains how to add a new module after it has already been installed.

1. Find the source code root directory where nginx is installed (that is, the directory where the installation package is stored). If not, download the new source code and decompress it.

cd software
ls
nginx-1.10.2 nginx-1.10.2.tar.gz

2. Check the nginx version and its compilation parameters

/usr/local/nginx/sbin/nginx -V

3. Enter the nginx source directory

cd nginx-1.10.2

4. Recompiled code and modules

./configure --prefix=/usr/local/nginx --with-http_ssl_module

5. Execute make (note: do not make install, otherwise the installation will be overwritten). After make, there will be an nginx in the /software/nginx-1.10.2/objs directory. This is the new version of the program.

6. Back up the old nginx program

cd /usr/local/nginx/sbin/
mv nginx nginx_bak

7. Copy the new nginx program to /usr/local/nginx/sbin/

cp /software/nginx-1.10.2/objs/nginx /usr/local/nginx/sbin/

8. Test whether the new nginx program is correct

/usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

9. Smooth service startup

/usr/local/nginx/sbin/nginx -s reload

Check if the module is installed

/usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.10.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (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

Restart Nginx

./nginx -s quit
./nginx

nginx reload module completed!

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Nginx dynamically forwards to upstream according to the path in the URL
  • Example of nginx ip blacklist dynamic ban
  • Nginx uses Lua+Redis to dynamically block IP
  • Detailed explanation of several ways to write Nginx dynamic DNS reverse proxy
  • How to dynamically add modules to Nginx

<<:  MySQL 8.0.11 Installation Tutorial under Windows

>>:  JavaScript example code to determine whether a file exists

Recommend

JavaScript to achieve the effect of clicking on the self-made menu

This article shares the specific code of JavaScri...

Detailed explanation of angular parent-child component communication

Table of contents APIs used Simple Example person...

How to add, delete and modify columns in MySQL database

This article uses an example to describe how to a...

Example of how to build a Harbor public repository with Docker

The previous blog post talked about the Registry ...

Tutorial on installing MySQL under Linux

Table of contents 1. Delete the old version 2. Ch...

Using JavaScript to implement carousel effects

This article shares the specific code for JavaScr...

Restart all stopped Docker containers with one command

Restart all stopped Docker containers with one co...

Real-time refresh of long connection on Vue+WebSocket page

Recently, the Vue project needs to refresh the da...

Native JS to achieve image marquee effects

Today I will share with you a picture marquee eff...

Essential skills for designing web front-end interfaces

[Required] UserInterface PhotoShop/Fireworks Desi...

Detailed explanation of webpage screenshot function in Vue

Recently, there is a requirement for uploading pi...