google / ngx_brotli

NGINX module for Brotli compression
BSD 2-Clause "Simplified" License
2.1k stars 216 forks source link

ngx_http_brotli_filter_module.so" is not binary compatible in /etc/nginx/nginx.conf:1 #106

Closed invinciblemuffi closed 4 years ago

invinciblemuffi commented 4 years ago

Followed this issue till end https://github.com/google/ngx_brotli/issues/95 .

Using Nginx 1.17.3 and 1.14.0 on Ubuntu 18.* on two different servers, both showing same error. Ran https://www.majlovesreg.one/adding-brotli-to-a-built-nginx-instance script and tried all alternatives given in the script file, still same error not binary compatible Any help would be appreciated.


Temporary build directory: /tmp/tmp.fR4QK184b3
Modules directory: /usr/lib/nginx/modules

--2020-08-10 07:13:12--  https://nginx.org/download/nginx-1.14.0.tar.gz
Resolving nginx.org (nginx.org)... 52.58.199.22, 3.125.197.172, 2a05:d014:edb:5702::6, ...
Connecting to nginx.org (nginx.org)|52.58.199.22|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1016272 (992K) [application/octet-stream]
Saving to: ‘nginx-1.14.0.tar.gz’

nginx-1.14.0.tar.gz                  100%[=====================================================================>] 992.45K   524KB/s    in 1.9s

2020-08-10 07:13:15 (524 KB/s) - ‘nginx-1.14.0.tar.gz’ saved [1016272/1016272]

Cloning into 'ngx_brotli'...
remote: Enumerating objects: 31, done.
remote: Counting objects: 100% (31/31), done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 200 (delta 11), reused 8 (delta 2), pack-reused 169
Receiving objects: 100% (200/200), 81.91 KiB | 16.38 MiB/s, done.
Resolving deltas: 100% (86/86), done.
Submodule 'deps/brotli' (https://github.com/google/brotli.git) registered for path 'deps/brotli'
Cloning into '/tmp/tmp.fR4QK184b3/ngx_brotli/deps/brotli'...
Submodule path 'deps/brotli': checked out 'd6d98957ca8ccb1ef45922e978bb10efca0ea541'
ionice: failed to execute ./configure --add-dynamic-module=../ngx_brotli --prefix=/usr/share/nginx --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-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_geoip_module=dynamic --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: No such file or directory
checking for OS
 + Linux 5.3.0-1030-aws x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
checking for gcc -pipe switch ... found
checking for -Wl,-E switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for gcc builtin 64 bit byteswap ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... found
checking for Linux specific features
checking for epoll ... found
checking for EPOLLRDHUP ... found
checking for EPOLLEXCLUSIVE ... found
checking for O_PATH ... found
checking for sendfile() ... found
checking for sendfile64() ... found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ... found
checking for prctl(PR_SET_KEEPCAPS) ... found
checking for capabilities ... found
checking for crypt_r() ... found
checking for sys/vfs.h ... found
checking for nobody group ... not found
checking for nogroup group ... found
checking for poll() ... found
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for crypt() ... not found
checking for crypt() in libcrypt ... found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... found
checking for O_DIRECT ... found
checking for F_NOCACHE ... not found
checking for directio() ... not found
checking for statfs() ... found
checking for statvfs() ... found
checking for dlopen() ... not found
checking for dlopen() in libdl ... found
checking for sched_yield() ... found
checking for sched_setaffinity() ... found
checking for SO_SETFIB ... not found
checking for SO_REUSEPORT ... found
checking for SO_ACCEPTFILTER ... not found
checking for SO_BINDANY ... not found
checking for IP_TRANSPARENT ... found
checking for IP_BINDANY ... not found
checking for IP_BIND_ADDRESS_NO_PORT ... found
checking for IP_RECVDSTADDR ... not found
checking for IP_SENDSRCADDR ... not found
checking for IP_PKTINFO ... found
checking for IPV6_RECVPKTINFO ... found
checking for TCP_DEFER_ACCEPT ... found
checking for TCP_KEEPIDLE ... found
checking for TCP_FASTOPEN ... found
checking for TCP_INFO ... found
checking for accept4() ... found
checking for eventfd() ... found
checking for int size ... 4 bytes
checking for long size ... 8 bytes
checking for long long size ... 8 bytes
checking for void * size ... 8 bytes
checking for uint32_t ... found
checking for uint64_t ... found
checking for sig_atomic_t ... found
checking for sig_atomic_t size ... 4 bytes
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for system byte ordering ... little endian
checking for size_t size ... 8 bytes
checking for off_t size ... 8 bytes
checking for time_t size ... 8 bytes
checking for AF_INET6 ... found
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for pwritev() ... found
checking for sys_nerr ... found
checking for localtime_r() ... found
checking for clock_gettime(CLOCK_MONOTONIC) ... found
checking for posix_memalign() ... found
checking for memalign() ... found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found
checking for System V shared memory ... found
checking for POSIX semaphores ... not found
checking for POSIX semaphores in libpthread ... found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ... found
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... found
configuring additional dynamic modules
adding module in ../ngx_brotli
 + ngx_brotli was configured
checking for PCRE library ... found
checking for PCRE JIT support ... found
checking for zlib library ... found
creating objs/Makefile

Configuration summary
  + using system PCRE library
  + OpenSSL library is not used
  + using system zlib library

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"
  nginx http access log file: "/usr/local/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

make -f objs/Makefile modules
make[1]: Entering directory '/tmp/tmp.fR4QK184b3/nginx-1.14.0'
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/common/dictionary.o \
    ../ngx_brotli/deps/brotli/c/common/dictionary.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/common/transform.o \
    ../ngx_brotli/deps/brotli/c/common/transform.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/backward_references.o \
    ../ngx_brotli/deps/brotli/c/enc/backward_references.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/backward_references_hq.o \
    ../ngx_brotli/deps/brotli/c/enc/backward_references_hq.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/bit_cost.o \
    ../ngx_brotli/deps/brotli/c/enc/bit_cost.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/block_splitter.o \
    ../ngx_brotli/deps/brotli/c/enc/block_splitter.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/brotli_bit_stream.o \
    ../ngx_brotli/deps/brotli/c/enc/brotli_bit_stream.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/cluster.o \
    ../ngx_brotli/deps/brotli/c/enc/cluster.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/compress_fragment.o \
    ../ngx_brotli/deps/brotli/c/enc/compress_fragment.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/compress_fragment_two_pass.o \
    ../ngx_brotli/deps/brotli/c/enc/compress_fragment_two_pass.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/dictionary_hash.o \
    ../ngx_brotli/deps/brotli/c/enc/dictionary_hash.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/encode.o \
    ../ngx_brotli/deps/brotli/c/enc/encode.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/encoder_dict.o \
    ../ngx_brotli/deps/brotli/c/enc/encoder_dict.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/entropy_encode.o \
    ../ngx_brotli/deps/brotli/c/enc/entropy_encode.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/histogram.o \
    ../ngx_brotli/deps/brotli/c/enc/histogram.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/literal_cost.o \
    ../ngx_brotli/deps/brotli/c/enc/literal_cost.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/memory.o \
    ../ngx_brotli/deps/brotli/c/enc/memory.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/metablock.o \
    ../ngx_brotli/deps/brotli/c/enc/metablock.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/static_dict.o \
    ../ngx_brotli/deps/brotli/c/enc/static_dict.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/enc/utf8_util.o \
    ../ngx_brotli/deps/brotli/c/enc/utf8_util.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/filter/ngx_http_brotli_filter_module.o \
    ../ngx_brotli/filter/ngx_http_brotli_filter_module.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/ngx_http_brotli_filter_module_modules.o \
    objs/ngx_http_brotli_filter_module_modules.c
cc -o objs/ngx_http_brotli_filter_module.so \
objs/addon/common/dictionary.o \
objs/addon/common/transform.o \
objs/addon/enc/backward_references.o \
objs/addon/enc/backward_references_hq.o \
objs/addon/enc/bit_cost.o \
objs/addon/enc/block_splitter.o \
objs/addon/enc/brotli_bit_stream.o \
objs/addon/enc/cluster.o \
objs/addon/enc/compress_fragment.o \
objs/addon/enc/compress_fragment_two_pass.o \
objs/addon/enc/dictionary_hash.o \
objs/addon/enc/encode.o \
objs/addon/enc/encoder_dict.o \
objs/addon/enc/entropy_encode.o \
objs/addon/enc/histogram.o \
objs/addon/enc/literal_cost.o \
objs/addon/enc/memory.o \
objs/addon/enc/metablock.o \
objs/addon/enc/static_dict.o \
objs/addon/enc/utf8_util.o \
objs/addon/filter/ngx_http_brotli_filter_module.o \
objs/ngx_http_brotli_filter_module_modules.o \
-lm \
-shared
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/addon/static/ngx_http_brotli_static_module.o \
    ../ngx_brotli/static/ngx_http_brotli_static_module.c
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules \
    -o objs/ngx_http_brotli_static_module_modules.o \
    objs/ngx_http_brotli_static_module_modules.c
cc -o objs/ngx_http_brotli_static_module.so \
objs/addon/static/ngx_http_brotli_static_module.o \
objs/ngx_http_brotli_static_module_modules.o \
-shared
make[1]: Leaving directory '/tmp/tmp.fR4QK184b3/nginx-1.14.0'

Sucessfully built and installed latest Brotli for NGINX 1.14.0
Modules can be found in /usr/lib/nginx/modules
Next step: Configure dynamic modules and reload/restart NGINX.

################################################################################

root@ip-*.*.*.*:~# nginx -t
nginx: [emerg] module "/usr/share/nginx/modules/ngx_http_brotli_filter_module.so" is not binary compatible in /etc/nginx/nginx.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed```

Why here it shows no file or directory, and still the script runs fine modules are build and everything till the end the script finishes.

`ionice: failed to execute ./configure --add-dynamic-module=../ngx_brotli --prefix=/usr/share/nginx --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-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_geoip_module=dynamic --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: No such file or directory`
eustas commented 4 years ago

If I understand correctly - there are 3 factors of success:

So, what does nginx -V reports?

invinciblemuffi commented 4 years ago

If I understand correctly - there are 3 factors of success:

  • nginx itself should be compiled with --with-compat
  • same version of nginx source code should be used for compiling add-on
  • same compilation flags and compiler should be used

So, what does nginx -V reports?

  1. nginx was already installed in the server.
  2. checked the version using nginx -v and downloaded the same version for module compilation. nginx version: nginx/1.17.3 and on other server its 1.14.0
  3. nginx -V returns --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-stream_geoip_module=dynamic --with-mail=dynamic --with-mail_ssl_module --add-dynamic-module=debian/extra/njs/nginx --add-dynamic-module=debian/extra/ngx_pagespeed --add-dynamic-module=debian/extra/headers-more-nginx-module --add-dynamic-module=debian/extra/lua-nginx-module --add-dynamic-module=debian/extra/naxsi/naxsi_src/ --add-dynamic-module=debian/extra/nginx-length-hiding-filter-module --add-dynamic-module=debian/extra/Session-Binding-Proxy/nginx_session_binding_proxy_module --add-dynamic-module=debian/extra/ngx_devel_kit --add-dynamic-module=debian/extra/ngx_http_upstream_order --add-dynamic-module=debian/extra/rds-json-nginx-module --add-dynamic-module=debian/extra/testcookie-nginx-module --add-dynamic-module=debian/extra/ngx_brotli --add-dynamic-module=debian/extra/ngx_postgres --add-dynamic-module=debian/extra/nchan --add-dynamic-module=debian/extra/ngx_http_auth_pam_module --add-dynamic-module=debian/extra/echo-nginx-module --add-dynamic-module=debian/extra/nginx-upstream-fair --add-dynamic-module=debian/extra/ngx_cache_purge --add-dynamic-module=debian/extra/ngx-fancyindex --add-dynamic-module=debian/extra/nginx-upload-progress-module --add-dynamic-module=debian/extra/ngx_http_substitutions_filter_module --add-dynamic-module=debian/extra/graphite-nginx-module --add-dynamic-module=debian/extra/nginx-module-vts --add-dynamic-module=debian/extra/nginx-ct --add-dynamic-module=debian/extra/nginx-rtmp-module --add-dynamic-module=debian/extra/nginx-ts-module --add-dynamic-module=debian/extra/nginx-module-sts --add-dynamic-module=debian/extra/nginx-module-stream-sts --add-dynamic-module=debian/extra/ngx_http_geoip2_module --add-dynamic-module=debian/extra/ngx_http_proxy_connect_module --with-threads --with-http_slice_module --with-file-aio --with-http_v2_module --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-CdgtSs/nginx-1.17.3-2=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -DTCP_FASTOPEN=23' --with-ld-opt='-Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs -Wl,-z,relro -Wl,-z,now'
invinciblemuffi commented 4 years ago

Any pointers?

Daniel15 commented 4 years ago

If you're using the script at https://www.majlovesreg.one/adding-brotli-to-a-built-nginx-instance, you need to uncomment the line under:

# Get configure parameters of installed NGINX. Not needed if NGINX was configured '--with-compat'.
# Uncomment one of the lines below if the script sucessfully builds modules but NGINX throws a "not binary compatible" error.

Since your Nginx build wasn't compiled with --with-compat (as per your comment above). Did you try that?

By the way, Nginx 1.14.0 is quite old now, so it might be worth trying with a newer version. The script worked fine for me with Nginx 1.18.0 on Debian Testing (bullseye).

invinciblemuffi commented 4 years ago

If you're using the script at https://www.majlovesreg.one/adding-brotli-to-a-built-nginx-instance, you need to uncomment the line under:

# Get configure parameters of installed NGINX. Not needed if NGINX was configured '--with-compat'.
# Uncomment one of the lines below if the script sucessfully builds modules but NGINX throws a "not binary compatible" error.

Since your Nginx build wasn't compiled with --with-compat (as per your comment above). Did you try that?

By the way, Nginx 1.14.0 is quite old now, so it might be worth trying with a newer version. The script worked fine for me with Nginx 1.18.0 on Debian Testing (bullseye).

I have tried this same script on Nginx 1.17.3 on Ubuntu 18.* on my other server, error remains same. There are 4 lines of confparams and I have tried all four of them by commenting/uncommenting one by one for every build and still this issue persists.

I also tried building the modules by copy pasting the nginx -V flags, still the same error.

invinciblemuffi commented 4 years ago

Finally I got it working. These are the steps I followed for below OS's.

Ubuntu 16.* and Ubuntu 18.*
nginx -v 
Note: Nginx version should be above 1.14.* for installing `nginx-module-brotli`
Incase your Nginx version is < 1.14.*, please refer to below link and update it first.

https://medium.com/@soban1193/upgrading-nginx-to-the-latest-version-on-ubuntu-c0ad9116cf87

sudo apt-get install brotli nginx-module-brotli

Over here if you already have it installed and there are some errors while implementing it in nginx, you can remove the package sudo apt-get purge nginx-module-brotli and do a fresh install.

On how to remove your package properly you can refer to this https://askubuntu.com/questions/187888/what-is-the-correct-way-to-completely-remove-an-application

sudo nano /etc/nginx/nginx.conf

nginx.conf

#include /etc/nginx/modules-enabled/*.conf;
user www-data;
worker_processes auto;
pid /run/nginx.pid;

load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;

 - inside of http block

gzip on;
        gzip_disable "msie6";

         gzip_vary on;
         gzip_proxied any;
         gzip_comp_level 6;
         gzip_buffers 16 8k;
         gzip_http_version 1.1;
         gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;

        brotli on;
        brotli_comp_level 4;
        brotli_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
        brotli_static on;

nginx -t service nginx restart

Done.

eustas commented 4 years ago

Awesome! Going to document that somewhere.

invinciblemuffi commented 4 years ago

Awesome! Going to document that somewhere.

@eustas I would be happy to document it so that others can get benefits from it but i don't know where to document. Please advise.