15

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

0

2 Answers 2

18

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.

2
  • 4
    On my Ubuntu Server 16.04.1 system, nginx -V doesn't include --modules-path. Nov 3, 2016 at 19:30
  • 1
    @DerekMahar You'll have to take that up with Canonical. I personally avoid Ubuntu for anything important. Nov 3, 2016 at 20:36
10

nginx -V will only reveal the --modules-path config flag if nginx was configured with an explicit --modules-path argument. (I.e., if you ran ./configure --modules-path=/path/to/modules when compiling nginx, you'd see --modules-path=/path/to/modules in the output of nginx -V.) 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.

As with many *nix-adjacent things, configuration is privileged over convention here. You may find that your best bet is to compile nginx on your own, specifying the --prefix= and/oror --modules-path= flags when running ./configure. There are some good docs on that process here and here.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .