Where does nginx expect to find its modules?

Derek Mahar asked:

Where does nginx expect to find the binary files for its modules? For example, by convention, where should I install module nginx_ajp_module?

My answer:

The module path will vary depending on the Linux distribution you’re using. Some distros (e.g. Debian-based) may put it in strange places.

To find the module path on your system, run nginx -V and look for the --modules-path in the output. For example:

nginx version: nginx/1.10.1
built by gcc 6.1.1 20160510 (Red Hat 6.1.1-2) (GCC) 
built with OpenSSL 1.0.2h-fips  3 May 2016 (running with OpenSSL 1.0.2j-fips  26 Sep 2016)
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules ...

You should also be aware that dynamic module loading was only introduced in the 1.10 development cycle. Modules older than this were designed to be compiled directly into nginx, and would need to be updated for dynamic loading. The module you linked to is such a one. Contact its developer for further information.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.