Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure additional modules to nginx after installation?

Tags:

nginx

I have installed Nginx in our redhat machine using rpm. Now we want to add nginx-rtmp module, but inorder to add new module as per the document i need to build it by downloading the tar ball. Does it mean that i have to remove the rpm and install it as per the document.

Ref: https://github.com/arut/nginx-rtmp-module/wiki/Getting-started-with-nginx-rtmp

./configure --add-module=/usr/build/nginx-rtmp-module
make
make install
like image 962
user1595858 Avatar asked Apr 17 '13 01:04

user1595858


People also ask

How do I enable a module in NGINX?

Then you include the load_module directive in the NGINX Plus configuration file for each dynamic module. For example, to enable njs dynamic modules, specify the load_module directives in the top-level (“ main ”) context of the main NGINX Plus configuration file (nginx. conf):

How do I know if NGINX modules are installed?

Find which flags Nginx was compiled with under Unixlog --error-log-path=/var/log/nginx/error. log --lock-path=/var/lock/nginx. lock --pid-path=/run/nginx. pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body .... ..

Where are NGINX modules located?

The default location, if no path was specified at compile time, is $NGX_PREFIX/modules . On my macOS system, $NGX_PREFIX defaults to /usr/local/nginx , so the default modules path is /usr/local/nginx/modules ; whereas Ubuntu 17.10 breaks the prefixed monolith up a bit and expects modules in /usr/lib/nginx/modules .


3 Answers

With nginx 1.9.11, it's not necessary to recompile the server, as they added support for dynamic modules. Take a look here: https://www.nginx.com/blog/dynamic-modules-nginx-1-9-11/

like image 182
jekennedy Avatar answered Sep 23 '22 10:09

jekennedy


Unlike Apache, all modules, including the 3rd party modules, are going to be compiled into nginx. So every time you want to add a new module, you have to recompile nginx.

So yes, you have to install it as per the document. There is no much value of keeping 2 nginx runtimes on the same server any way. So you may also want to remove the previous nginx.

like image 38
Chuan Ma Avatar answered Sep 23 '22 10:09

Chuan Ma


I had a similar problem where the auth-pam module broke after an upgrade. Here's what fixed it for me (debian stretch/sid, nginx 1.10.2):

apt install libnginx-mod-http-auth-pam
ln -s /usr/share/nginx/modules-available/mod-http-auth-pam.conf /etc/nginx/modules-enabled/50-mod-http-auth-pam.conf

The config file contains a single “load_module” directive which tells nginx to dynamically load the module on startup. As jekennedy mentioned, this would only apply to newer versions of nginx that support dynamic module loading.

like image 6
campkeith Avatar answered Sep 21 '22 10:09

campkeith