Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of recompiling and adding Modules in Nginx

Shulou Source: shulou.com Published: 2022-06-02 03:06:29 09月13日 Update

When compiling and installing Nginx, some modules are not installed by default, such as http_ssl_module, so you must add this module in order for Nginx to support HTTPS.

Here's how to add a new module again after it has been installed.

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

Cd softwarelsnginx-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 a 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-tnginx: the configuration file / usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file / usr/local/nginx/conf/nginx.conf test is successful

9. Start the service smoothly

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

Check to see if the module is installed

/ usr/local/nginx/sbin/nginx-Vnginx version: nginx/1.10.2built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC) built with OpenSSL 1.0.1e-fips 11 Feb 2013TLS SNI support enabledconfigure arguments:-- prefix=/usr/local/nginx-- with-http_ssl_module

Restart Nginx

. / nginx-s quit./nginx

Nginx reload module completed!

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.

Tags: Modules programs compilers source code directories that is support smoothing code content again parameters backup time root directory version later learning help service Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info MySQL Shulou Technology Redmi Linux