load_module with "./configure ... --modules-path=<path> ..."

Maxim Dounin mdounin at mdounin.ru
Thu Jul 13 00:36:50 UTC 2023


Hello!

On Wed, Jul 12, 2023 at 06:40:21PM -0300, Fabiano Furtado Pessoa Coelho wrote:

> Hello...
> 
> I have compiled NGINX 1.24.0 with "./configure ... --modules-path=<path> ...".
> 
> Therefore, the "load_module" directive is not reading the path/config
> specified in "--modules-path" parameter. For instance, in nginx.conf,
> I have declared "load_module ngx_http_module1.so;" and when I test it,
> the following message appears:
> # nginx -t
> nginx: [emerg] dlopen() "/etc/nginx/ngx_http_module1.so" failed
> (/etc/nginx/ngx_http_module1.so: cannot open shared object file: No
> such file or directory) in /etc/nginx/nginx.conf:12
> nginx: configuration file /etc/nginx/nginx.conf test failed
> 
> Why? Should the "load_module" directive read "--modules-path" value,
> if specified in "./configure"? From the "load_module" official
> documentation (http://nginx.org/en/docs/ngx_core_module.html#load_module),
> there is no default value defined, but, once "--modules-path" is
> configured, the "load_module" directive should read from
> "--modules-path", right? If not, what is the purpose of "./configure
> ... --modules-path=<path> ...", to compile NGINX?
> 
> Of course, if I specify the full path "load_module
> /<path>/ngx_http_module1.so;", it works fine.

The "--modules-path" configure option defines a directory where 
dynamic modules will be installed by "make install" and only used 
during installation.

The "load_module" configuration directive, if used with relative 
paths, resolves such paths from "--prefix", much like most of the 
configuration directives.  Note the example in the documentation 
(http://nginx.org/r/load_module):

    load_module modules/ngx_mail_module.so;

This example assumes the default "--modules-path", so modules are 
installed into the "modules" directory under prefix.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list