• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved Plesk and Brotli

Kulturmensch

Regular Pleskian
My server with nginx stand alone:

Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz (10 core(s))
VersionPlesk Obsidian v18.0.40_build1800211207.16 os_Ubuntu 20.04
OSUbuntu 20.04.3 LTS

A recent test (Does your website support Brotli?) showed that brotli is not enabled although it should be by default..

I found, that the necessary modules are available:
/etc/nginx/modules.conf.d/brotli.conf
content :
load_module nginx/modules/ngx_http_brotli_filter_module.so;
load_module nginx/modules/ngx_http_brotli_static_module.so;

but a conf-file for Brotli does not exist.
So, I created: /etc/nginx/conf.d/brotli.conf with the content:
brotli on;
brotli_comp_level 6;
brotli_static on;
brotli_types application/atom+xml application/javascript application/json application/rss+xml
application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype
application/x-font-ttf application/x-javascript application/xhtml+xml application/xml
font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon
image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml;

But now the syntax check gave an error:

nginx -t
nginx: [emerg] unknown directive "brotli" in /etc/nginx/conf.d/brotli.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed

Any idea how to make brotli running on my server?
 
What modules are loaded right now?

Try: nginx -V

It should give something like:

configure arguments: --prefix=/usr/share --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --modules-path=/usr/share/nginx/modules --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --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 --user=nginx --group=nginx --with-file-aio --with-compat --with-http_ssl_module --with-http_realip_module --with-http_sub_module --with-http_dav_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_v2_module --add-dynamic-module=mod_brotli --add-dynamic-module=mod_passenger/src/nginx_module --add-dynamic-module=mod_pagespeed --add-dynamic-module=mod_security --with-openssl=lib_openssl --with-openssl-opt='zlib no-idea no-mdc2 no-rc5 no-ssl2 no-shared -fpic'

btw:
This site gives a valid result: Brotli Test, Brotli Compression Test | IPVoid
This one gave the wrong result: Does your website support Brotli?
 
This brings nginx -V up:
nginx version: nginx/1.20.1
built with OpenSSL 1.1.1f 31 Mar 2020
TLS SNI support enabled
configure arguments: --prefix=/usr/share
--sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
--modules-path=/usr/share/nginx/modules
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--lock-path=/var/lock/nginx.lock
--pid-path=/run/nginx.pid
--http-client-body-temp-path=/var/ib/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
--user=nginx
--group=nginx
--with-file-aio
--with-compat
--with-http_ssl_module
--with-http_realip_module
--with-http_sub_module
--with-http_dav_module
--with-http_gzip_static_module
--with-http_stub_status_module
--with-http_v2_module
--add-dynamic-module=mod_brotli
--add-dynamic-module=mod_passenger/src/nginx_module
--add-dynamic-module=mod_pagespeed
--add-dynamic-module=mod_security

Seems that brotli-module get loaded. But where can I configure it? I.e. compression rate etc.?
Your both test links gave the same result in my case: Brotli compression is not enabled!
 
I guess is doesn't work because nginx -t failed.

Can you start with this minimum setup and check if this works?

$ cat /etc/nginx/conf.d/brotli.conf
brotli on;
brotli_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
 
This is the result:
nginx -t
nginx: [emerg] unknown directive "brotli" in /etc/nginx/conf.d/brotli.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
 
This is my nginx.conf. Modules are loaded on top before the http part - seems to be ok?

#user nginx;
worker_processes 1;

#error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;

#pid /var/run/nginx.pid;

include /etc/nginx/modules.conf.d/*.conf;

events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;
#tcp_nodelay on;

#gzip on;
#gzip_disable "MSIE [1-6]\.(?!.*SV1)";

server_tokens off;

include /etc/nginx/conf.d/*.conf;
}

# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;
 
Tried many new attemps - nothing works.

Always: nginx: [emerg] unknown directive "brotli" in /etc/nginx/conf.d/brotli.conf:1

Any idea?
 
Do you have the same output with the correct symlinks?

Code:
# ll /etc/nginx/modules.conf.d/*.conf
lrwxrwxrwx. 1 root root 34 Jan 27  2021 /etc/nginx/modules.conf.d/brotli.conf -> ../modules.available.d/brotli.load
lrwxrwxrwx. 1 root root 37 Mar  4  2019 /etc/nginx/modules.conf.d/pagespeed.conf -> ../modules.available.d/pagespeed.load
-rw-r--r--. 1 root root 56 Nov 30 16:08 /etc/nginx/modules.conf.d/phusion-passenger.conf
 
Hi Igor, wish you a happy New Year and thank you for jumping in.

# ll /etc/nginx/modules.conf.d/*.conf
Result is no access also I am logged in as root :
# ll /etc/nginx/modules.conf.d/*.conf
ls: Zugriff auf '/etc/nginx/modules.conf.d/*.conf' nicht möglich: Datei oder Verzeichnis nicht gefunden

Going directly to this directory I found it is empty.

But I found
# ll /etc/nginx/modules.available.d/*
-rw-r--r-- 1 root root 125 Dez 24 20:23 /etc/nginx/modules.available.d/brotli.load
-rw-r--r-- 1 root root 58 Okt 1 14:03 /etc/nginx/modules.available.d/modsecurity.load
-rw-r--r-- 1 root root 44 Okt 1 14:03 /etc/nginx/modules.available.d/pagespeed.load

and
# ll /etc/nginx/plesk.conf.d/*.conf
-rw------- 1 root nginx 5845 Jan 1 17:22 /etc/nginx/plesk.conf.d/server.conf
 
Now I added the 2 symlinks by myself :
ll /etc/nginx/modules.conf.d/*.conf
lrwxrwxrwx 1 root root 34 Jan 2 18:33 /etc/nginx/modules.conf.d/brotli.conf -> ../modules.available.d/brotli.load
lrwxrwxrwx 1 root root 37 Jan 2 18:34 /etc/nginx/modules.conf.d/pagespeed.conf -> ../modules.available.d/pagespeed.load

After restart of nginx (no problem) with service nginx restart I added the directive brotli on; to the NGINX Konfiguration via Plesk UI. Then the result is again:
Ungültige nginx-Konfiguration: nginx: [emerg] unknown directive "brotli" in /var/www/vhosts/system/test.XXX.de/conf/vhost_nginx.conf:10 nginx: configuration file /etc/nginx/nginx.conf test failed
 
I
curl -IL https://test.mydomain.de -H "Accept-Encoding: br"
HTTP/2 200
server: nginx
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
...
...
content-encoding: br

Now it works. Main problem have been the missing symlinks. Thanks to Igor! My fault was, to install the symlinks but not to check the content of the new ones - which were empty after this action:-(.
Adding now
load_module nginx/modules/ngx_http_brotli_filter_module.so;
load_module nginx/modules/ngx_http_brotli_static_module.so;
to brotli.conf i.e. brotli.load gives the result as shown above.


Can anybody tell me the content of pagespeed.load please as I deleted it:-(

Thanks all for the help!
 
Thank you. Did you something special configure in nginx.conf to make pagespeed work or does it work from the scratch after loading this module?
 
I have now configured pagespeed following the recipe of your link. Although the new cache (/var/cache/new-cache) is filling up with content but the described test
curl -Is my.domain | grep X-Page-Speed
X-Page-Speed: 1.13.35.2-0

does not bring up any output? Any idea? However, most important was to enable brotli and here we succeeded:)
 
Same here, no output from the curl command. But you can check if it works using the developer tools in your browser.
I used the Network-tab in the Firefox developer tools. It looks like this:

Screenshot 2022-01-03 at 20.26.44.png
 
Same here, no output from the curl command. But you can check if it works using the developer tools in your browser.
I used the Network-tab in the Firefox developer tools. It looks like this:

View attachment 19994
Ah, the header is lower case.
Try curl -Is my.domain | grep x-page-speed
or, to avoid this problem altogether, curl -Is my.domain | grep -i x-page-speed
 
Back
Top