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
nginx version: nginx/1.18.0
built by gcc 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2)
built with OpenSSL 1.1.1f 31 Mar 2020
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2
-fdebug-prefix-map=/build/nginx-lUTckl/nginx-1.18.0=.
-fstack-protector-strong -Wformat -Werror=format-security -fPIC
-Wdate-time -D_FORTIFY_SOURCE=2'
--with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC'
--prefix=/usr --conf-path=/etc/nginx/nginx.conf
--http-log-path=/var/log/nginx/access.log
--error-log-path=/var/log/nginx/error.log
--lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid
--modules-path=/usr/lib/nginx/modules
--http-client-body-temp-path=/var/lib/nginx/body
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
--http-proxy-temp-path=/var/lib/nginx/proxy
--http-scgi-temp-path=/var/lib/nginx/scgi
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-compat
--with-pcre-jit --with-http_ssl_module --with-http_stub_status_module
--with-http_realip_module --with-http_auth_request_module
--with-http_v2_module --with-http_dav_module --with-http_slice_module
--with-threads --with-http_addition_module --with-http_gunzip_module
--with-http_gzip_static_module --with-http_image_filter_module=dynamic
--with-http_sub_module --with-http_xslt_module=dynamic
--with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic
--with-mail_ssl_module
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?
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.
--
Maxim Dounin
http://mdounin.ru/
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