Welcome to Centmin Mod Community
Become a Member

Nginx Brotli - Yes or No?

Discussion in 'Install & Upgrades or Pre-Install Questions' started by anthony parsons, Jul 29, 2018.

  1. anthony parsons

    anthony parsons Premium Member Premium Member

    77
    18
    8
    Feb 12, 2017
    Ratings:
    +22
    Local Time:
    9:28 PM
    Current yum stable
    10.1
    I have been reading through the performance guide, got to Brotli and am unsure whether to enable it or not in latest beta build.

    I use cloudflare, so all HTTPS. Am I going to see a benefit enabling Brotli for NGINX behind cloudflare, or am I wasting my time and server resources with Brotli, and better to leave cloudflare do their thing with cached data as sent to them via default centmin install?
     
  2. eva2000

    eva2000 Administrator Staff Member

    36,422
    7,994
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,308
    Local Time:
    8:28 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    No need for Nginx Brotli if Cloudflare in front with Brotli enabled :)

    Nginx - How to use Brotli compression for Centmin Mod Nginx web servers

     
  3. anthony parsons

    anthony parsons Premium Member Premium Member

    77
    18
    8
    Feb 12, 2017
    Ratings:
    +22
    Local Time:
    9:28 PM
    Current yum stable
    10.1
    Ok, so nginx is currently built using --with-zlib=../zlib-cloudflare-1.3.0. When I use the centmin menu 4, is there an option to adjust this and add:

    --add-module=ngx_brotli_module

    And that will enable it? Do I have to add something to custom config to enable / disable either one?
     
  4. eva2000

    eva2000 Administrator Staff Member

    36,422
    7,994
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,308
    Local Time:
    8:28 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  5. anthony parsons

    anthony parsons Premium Member Premium Member

    77
    18
    8
    Feb 12, 2017
    Ratings:
    +22
    Local Time:
    9:28 PM
    Current yum stable
    10.1
    Ok, I thought the cloudflare one was different. But it all works on the same thing, so enable Brotli compression and cloudflare will do its thing with that.

    You've thought of everything here it seems.
     
    • Like Like x 1
  6. eva2000

    eva2000 Administrator Staff Member

    36,422
    7,994
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,308
    Local Time:
    8:28 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Yeah Centmin Mod is basically what I'd do myself - just automated :D
     
  7. anthony parsons

    anthony parsons Premium Member Premium Member

    77
    18
    8
    Feb 12, 2017
    Ratings:
    +22
    Local Time:
    9:28 PM
    Current yum stable
    10.1
    Ok, doing some testing, but ran into a problem.

    I removed:

    NGXDYNAMIC_BROTLI='y'
    NGINX_LIBBROTLI='y'

    Rebuilt nginx, and now when doing a webpage test, there is no image compression.

    I ran:

    Code:
    curl -sI /dev/null -H"Accept-Encoding: gzip" https://wotbforum.com/attachments/a-man-laying-on-the-railroad-tracks-not-exactly-the-smartest-thing-to-do_stf-bbp0rj-jpg.2
    Code:
    HTTP/1.1 301 Moved Permanently
    
    Date: Sun, 29 Jul 2018 02:22:53 GMT
    
    Content-Type: text/html; charset=utf-8
    
    Connection: keep-alive
    
    Set-Cookie: __cfduid=d8540b9a657db08fd67f8253daa6cc1851532830972; expires=Mon, 29-Jul-19 02:22:52 GMT; path=/; domain=.wotbforum.com; HttpOnly; Secure
    
    X-Frame-Options: SAMEORIGIN
    
    X-Content-Type-Options: nosniff
    
    Last-Modified: Sun, 29 Jul 2018 02:22:52 GMT
    
    Location: https://wotbforum.com/attachments/a-man-laying-on-the-railroad-tracks-not-exactly-the-smartest-thing-to-do_stf-bbp0rj-jpg.2/
    
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    
    Cache-Control: private, no-cache, max-age=0
    
    Set-Cookie: xf_session=XY4G-ejQ1gUC-4sgWG84XOkGsY3C_daO; path=/; secure; HttpOnly
    
    X-Powered-By: centminmod
    
    X-Xss-Protection: 1; mode=block
    
    Strict-Transport-Security: max-age=15552000; includeSubDomains; preload
    
    Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
    
    Server: cloudflare
    
    CF-RAY: 441c1ec9add592d0-SJC
    I'm not getting Content-Encoding: gzip in my output, and thus at all.
     
  8. anthony parsons

    anthony parsons Premium Member Premium Member

    77
    18
    8
    Feb 12, 2017
    Ratings:
    +22
    Local Time:
    9:28 PM
    Current yum stable
    10.1
    Why am I not getting image compression suddenly?
     
  9. anthony parsons

    anthony parsons Premium Member Premium Member

    77
    18
    8
    Feb 12, 2017
    Ratings:
    +22
    Local Time:
    9:28 PM
    Current yum stable
    10.1
    Hang on... it doesn't seem that you compress images in the gzip_types
     
  10. eva2000

    eva2000 Administrator Staff Member

    36,422
    7,994
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,308
    Local Time:
    8:28 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    gzip and brotli only ever compress static text files css/js/html not images ;)

    images have never used on the fly compression - it would be wasted cpu time as images don't compress well
     
..