Opened 4 years ago

Closed 4 years ago

#961 closed defect (wontfix)

nginx does not load modules from --modules-path

Reported by: John Robeson Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.9.x
Keywords: Cc:
uname -a: Linux 4.4.7-300.fc23.x86_64 #1 SMP Wed Apr 13 02:52:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.10.0
built by gcc 5.3.1 20160406 (Red Hat 5.3.1-6) (GCC)
built with OpenSSL 1.0.2g-fips 1 Mar 2016
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream --with-google_perftools_module --add-dynamic-module=nginx-push-stream-module-0.5.2 --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'

Description

I'm building a custom nginx package based on the official Fedora 23 nginx package (spec source: http://pkgs.fedoraproject.org/cgit/rpms/nginx.git/tree/nginx.spec?h=f23). It configures nginx like so

./configure \
    --prefix=/usr/share/nginx \
    --sbin-path=/usr/sbin/nginx \
    --conf-path=/etc/nginx/nginx.conf \
# rest of the config can be seen in the linked spec

However, /usr/share shouldn't be used for loadable modules, so I added this:

   --modules-path=/usr/lib64/nginx/modules

and changed the image_filter module to be configured as a dynamic module like so:

  --with-http_image_filter_module=dynamic

So when i install nginx, the dynamic module ends up in /usr/lib64/nginx/modules as expected.

However, when I try to load the module with:

   load_module "ngx_http_image_filter_module.so";

and then start nginx, I get this error:

nginx: [emerg] dlopen() "/usr/share/nginx/ngx_image_filter_module.so" failed (/usr/share/nginx/ngx_http_image_filter_module.so: cannot open shared object file: No such file or directory) in /etc/nginx/modules-enabled/image_filter.conf:1

It seems that --modules-path only affects installation, but isn't actually used to find and load the module

Change History (1)

comment:1 by Maxim Dounin, 4 years ago

Resolution: wontfix
Status: newclosed

Exactly, --modules-path only affects where modules are installed. Paths in the configuration are resolved from prefix, and are expected to look like

    load_module modules/ngx_http_image_filter_module.so;

assuming default --modules-path. If you install modules into a different place, you'll have to use different paths in the configuration. Alternatively, you can consider using a symlink under the prefix to point to a correct directory.

Note: See TracTickets for help on using tickets.