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.
Thanks in advance.
Fabiano Furtado
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/
Hi Fabiano,
hope you're doing well.
On Wed, Jul 12, 2023 at 06:40:21PM -0300, Fabiano Furtado Pessoa Coelho wrote:
>
> I have compiled NGINX 1.24.0 with "./configure ... --modules-path=<path> ...".
The --modules-patch=<path> configure option defines a directory where
nginx dynamic modules will be installed, [1].
> Therefore, the "load_module" directive is not reading the path/config
> specified in "--modules-path" parameter.
The load_module directive, [2] utilizes a value of the --prefix configure
option, [1] as a relative path to the modules directory. An authentic
package on a linux operating system creates a symlink with the source
/usr/lib/nginx/modules directory and the /etc/nginx/modules target.
In that case it's easy to use
load_module modules/ngx_http_module_1.so;
to load a dynamic module.
References
1. https://nginx.org/en/docs/configure.html
2. https://nginx.org/en/docs/ngx_core_module.html#load_module
Thank you.
--
Sergey A. Osokin
Hello...
On Wed, Jul 12, 2023 at 9:37 PM Maxim Dounin wrote:
>
> 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> ...".
> >
...
> > /<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.
First of all, thanks for the help.
Is it a good idea to modify the "load_module" directive to read the
"--modules-path" parameter, if defined by "./configure", to use a
custom relative path instead of default "--prefix" relative path?
Thanks in advance.
Fabiano Furtado
Thanks for the help, Sergey!
On Wed, Jul 12, 2023 at 9:38 PM Sergey A. Osokin wrote:
>
> Hi Fabiano,
>
> hope you're doing well.
>
> On Wed, Jul 12, 2023 at 06:40:21PM -0300, Fabiano Furtado Pessoa Coelho wrote:
> >
> > I have compiled NGINX 1.24.0 with "./configure ... --modules-path=<path> ...".
>
> The --modules-patch=<path> configure option defines a directory where
> nginx dynamic modules will be installed, [1].
>
> > Therefore, the "load_module" directive is not reading the path/config
> > specified in "--modules-path" parameter.
>
> The load_module directive, [2] utilizes a value of the --prefix configure
> option, [1] as a relative path to the modules directory. An authentic
> package on a linux operating system creates a symlink with the source
> /usr/lib/nginx/modules directory and the /etc/nginx/modules target.
> In that case it's easy to use
>
> load_module modules/ngx_http_module_1.so;
>
> to load a dynamic module.
>
> References
> 1. https://nginx.org/en/docs/configure.html
> 2. https://nginx.org/en/docs/ngx_core_module.html#load_module
>
> Thank you.
>
> --
> Sergey A. Osokin
Hello!
On Thu, Jul 13, 2023 at 03:08:19PM -0300, Fabiano Furtado Pessoa Coelho wrote:
> Hello...
>
> On Wed, Jul 12, 2023 at 9:37 PM Maxim Dounin wrote:
> >
> > 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> ...".
> > >
> ...
> > > /<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.
>
> First of all, thanks for the help.
>
> Is it a good idea to modify the "load_module" directive to read the
> "--modules-path" parameter, if defined by "./configure", to use a
> custom relative path instead of default "--prefix" relative path?
No, adding yet another option to resolve relative paths in
configuration looks like a bad idea to me. Resolving these from
prefix looks perfectly correct and expected.
--
Maxim Dounin
http://mdounin.ru/
Hello...
On Fri, Jul 14, 2023 at 12:33 PM Maxim Dounin wrote:
>
> Hello!
>
> On Thu, Jul 13, 2023 at 03:08:19PM -0300, Fabiano Furtado Pessoa Coelho wrote:
>
> > Hello...
> >
> > On Wed, Jul 12, 2023 at 9:37 PM Maxim Dounin wrote:
> > >
> > > 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> ...".
> > > >
...
> > > This example assumes the default "--modules-path", so modules are
> > > installed into the "modules" directory under prefix.
> >
> > First of all, thanks for the help.
> >
> > Is it a good idea to modify the "load_module" directive to read the
> > "--modules-path" parameter, if defined by "./configure", to use a
> > custom relative path instead of default "--prefix" relative path?
>
> No, adding yet another option to resolve relative paths in
> configuration looks like a bad idea to me. Resolving these from
> prefix looks perfectly correct and expected.
All right! Thanks for the feedback.
Fabiano Furtado