Does Plesk support BROTLI compression for Apache or Nginx web server?

Follow

Comments

12 comments

  • Avatar
    Torsten Bulk

    Brodle is a must! I'm betting on Plesk to support it.

    0
    Comment actions Permalink
  • Avatar
    Kingsley Felix

    Since you know the importance of this feature, why do we still have to vote for it?

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    Hello @Kingsley Felix,

    More popular feature is, the higher priority of adding this feature will be for the development team. 

    0
    Comment actions Permalink
  • Avatar
    Anthony Forshaw

    Voting for Brotli compression also!  It should be more popular :)

    0
    Comment actions Permalink
  • Avatar
    SamParis

    Voting for Brotli too!

    Is there any way to install by CLI ?
    I found one for PHP, one for Apache and one for NGINX.

    If yes, which one will work for PHP-FPM?

    0
    Comment actions Permalink
  • Hello GetPageSpeed,

    Thanks for providing these instructions.

    Anyway, mind that in case of problems with Brotli module (or such configuration), we won't be supporting it until we officially provide it ourselves.

     

    DaliAbassi, please check out the previous message from GetPageSpeed.

    0
    Comment actions Permalink
  • Avatar
    SamParis

    Thank you Francisco Garcia for your answer, but I'm using Ubuntu and the package from GetPageSpeed is for Centos/RHEL.

    0
    Comment actions Permalink
  • Avatar
    Christoph Flathmann (Edited )

    You can compile a dynamic module yourself. As a temporary solution:

    Updated: added missing Step 9. (Run configure in ginx source directory)

    Best way is to run the steps below on your server. (Please keep a backup of your server or at least of your nginx config directory)
    You will not replace your nginx binary, this will just compile the ngx_brotli modul.
    If something goes wrong just delete the files that loads the module (Step 11. and 12.) or use backup config.

    Also Remember that you would have to rebuild this module once Plesk updates it's nginx server. 

    if nginx configure or make modules fail install missing libraries or take a look at https://talk.plesk.com/threads/how-to-compile-nginx-with-additional-modules-pagespeed-cache_purge-headers-more-and-others.340640/
    apt-get build-essential zlib1g-dev libpcre3 libpcre3-dev unzip

    1. Get your nginx Version (nginx -v).
      Output should be something like this nginx version: nginx/1.16.1
    2. Download the source of your version.
      wget https://nginx.org/download/nginx-1.16.1.tar.gz
    3. Extract the downloaded source:
      tar -xzvf nginx-1.16.1.tar.gz
    4. Get ngx_brotli:
      git clone https://github.com/google/ngx_brotli.git && cd ngx_brotli
      git submodule update --init --recursive
    5. run nginx -V to get your build variables. copy this to txt file or ceate a bash script.
    6. Add the path where your ngx_brotli folder is (Step 4.)
      --add-dynamic-module=/root/addons/nginx/modules/ngx_brotli
    7. remove following lines:
      --add-dynamic-module=mod_pagespeed
      --with-openssl=lib_openssl from your variables
      --add-dynamic-module=mod_passenger/src/nginx_module
    8. cd into your nginx source directory
    9. run ./configure with the variables from text file or via a bash script (Example https://gist.github.com/Chrissi2812/be8d22459a87b004ef6ab096533e7b34)
    10. run make modules this will create the modules in the objs directory
    11. copy ngx_http_brotli_filter_module.so and ngx_http_brotli_static_module.so from the objs directory
      to your nginx modules directory (/usr/share/nginx/modules)
    12. Create a new conf file to load the dynamic modules
      nano /etc/nginx/modules.conf.d/brotli.conf 
      With follwing content:
      load_module nginx/modules/ngx_http_brotli_filter_module.so;
      load_module nginx/modules/ngx_http_brotli_static_module.so;
    13. create /etc/nginx/conf.d/brotli.conf with follwing content (example taken from https://github.com/google/ngx_brotli#sample-configuration)
      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;
    14. run nginx -t to verify the configuration
    15. run service nginx restart

    Now all static files should be served via brotli. Proxied requests don't seem to work.

    Maybe plesk could ad the dynamic compiled modules, just like pagespeed and passenger??

    1
    Comment actions Permalink
  • Avatar
    Bragi Austfjord

    I don't get it.

    Could you explain this better "Add the path where of your ngx_brotli install"

    where? remove following lines:

    Please explain this better.

    0
    Comment actions Permalink
  • Avatar
    Leonid Gukhman

    Bragi Austfjord

    Thank you for sharing this solution! It might be useful for other Pleskians, too.

    0
    Comment actions Permalink
  • Avatar
    Sage Pointer

    Thank you Christoph Flathmann

    To me, on step 7 i also needed to remove these lines:
    --with-http_ssl_module
    --with-http_v2_module
    Maybe it's because i compiled on the another machine, not on the prod server, but in the end everything worked without any problems

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request