Closed invinciblemuffi closed 4 years ago
If I understand correctly - there are 3 factors of success:
--with-compat
So, what does nginx -V
reports?
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?
nginx version: nginx/1.17.3
and on other server its 1.14.0
--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'
Any pointers?
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).
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.
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.
Awesome! Going to document that somewhere.
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.
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.