nginx looking in wrong dir for module

Larry Martell larry.martell at gmail.com
Sun Feb 4 21:44:26 UTC 2024


On Fri, Feb 2, 2024 at 8:43 PM Maxim Dounin <mdounin at mdounin.ru> wrote:
>
> Hello!
>
> On Fri, Feb 02, 2024 at 01:07:40PM -0500, Larry Martell wrote:
>
> > I built nginx from source and it fails to start with:
> >
> > 2024/02/02 13:00:59 [emerg] 1961284#1961284: dlopen()
> > "/usr/modules/ndk_http_module.so" failed
> > (/usr/modules/ndk_http_module.so: cannot open shared object file: No
> > such file or directory) in
> > /etc/nginx/modules-enabled/10-mod-http-ndk.conf:1
> >
> > -V shows:
> >
> > $ sudo /usr/sbin/nginx -V
>
> [...]
>
> > --prefix=/usr
>
> [...]
>
> > --modules-path=/usr/lib/nginx/modules
>
> [...]
>
> > ndk_http_module.so does exist in /usr/lib/nginx/modules/:
> >
> > $ ls -l /usr/lib/nginx/modules/ndk_http_module.so
> > -rw-r--r-- 1 root root 18688 Nov 10  2022
> > /usr/lib/nginx/modules/ndk_http_module.so
> >
> > Why is it looking in the wrong dir for this?
>
> Paths in nginx configuration file are resolved from prefix (with
> the exception of various included configuration files or similar
> resources, which are resolved from configuration prefix).
>
> Your configuration seems to contain
>
>     load_module modules/ndk_http_module.so;
>
> which is resolved from /usr to /usr/modules/ndk_http_module.so.
> There is no such file, hence the error.
>
> Note that the --modules-path configure option defines where to
> install modules.  It is, however, your responsibility to provide
> proper paths to modules in load_module directives.  The
> "modules/foo.so" construct will work with the default
> --modules-path, which is "modules" under prefix, but you'll have
> to use something different if you've modified --modules-path to a
> custom value.

Thanks so much Maxim. It was not clear at all that --modules-path does
not set where it looks for modules and I have to set it with --prefix.
I set that to /usr so the nginx executable would end up in /usr/sbin,
but I can just copy it there after the make install.

Larry


More information about the nginx mailing list