google / ngx_brotli

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

CentOS 8, Directadmin with Nginx error installing brotli #114

Open Theolodewijk opened 3 years ago

Theolodewijk commented 3 years ago

My installation but still get some errors.

Configuration, CentOS 8 with directadmin and last version of nginx.



cd /usr/local/src
git clone https://github.com/google/ngx_brotli
cd ngx_brotli
git submodule update --init

{ result
    [root@mail ngx_brotli]# git submodule update --init
    Submodule 'deps/brotli' (https://github.com/google/brotli.git) registered for path 'deps/brotli'
    Cloning into '/usr/local/src/ngx_brotli/deps/brotli'...
    Submodule path 'deps/brotli': checked out 'e61745a6b7add50d380cfd7d3883dd6c62fc2c71'
}

cd /usr/local/directadmin/custombuild
wget https://nginx.org/download/nginx-1.19.6.tar.gz
tar -zxvf nginx-1.19.6.tar.gz
cd nginx-1.19.6

./configure --with-compat --add-dynamic-module=/usr/local/src/ngx_brotli
make modules

nano /etc/nginx/nginx.conf

# add above the http block
load_module /usr/local/nginx/modules/ngx_http_brotli_filter_module.so;
load_module /usr/local/nginx/modules/ngx_http_brotli_static_module.so;

./configure --add-module=/usr/local/src/ngx_brotli
make && make install

{ result
    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"
}

nginx -t

{ result
    [root@mail nginx-1.19.6]# nginx -t
    nginx: [emerg] "load_module" directive is specified too late in /etc/nginx/nginx.conf:14
    nginx: configuration file /etc/nginx/nginx.conf test failed
}  

# Error missing files.
mkdir /usr/modules
cp /usr/local/directadmin/custombuild/nginx-1.19.6/objs/*.so /usr/modules
ls /usr/modules
chmod 644 /usr/modules/*.soso

{ changed positon and fixed the missing files.
    [root@mail nginx-1.19.6]# nginx -t
    nginx: [emerg] module "/usr/modules/ngx_http_brotli_filter_module.so" is not binary compatible in /etc/nginx/nginx.conf:10
    nginx: configuration file /etc/nginx/nginx.conf test failed
}

systemctl reload nginx.service```
dvershinin commented 3 years ago

@Theolodewijk Apparently you compiled the module against an NGINX version that is different from the one installed. Check this article about DirectAdmin also.

pujianto commented 2 years ago

You can try this bash helper script to install or recompile the ngx_brotli module after updating nginx. https://gist.github.com/pujianto/795e858f11ffc3073a24f60217fcba1a