The Apache Haus Forum

Advanced search  

News:

Welcome to Apache Haus Distribution Forum

Pages: [1]   Go Down

Author Topic: mod_brotli sample configuration  (Read 1320 times)

Gregg

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 839
mod_brotli sample configuration
« on: June 17, 2017, 06:05:55 AM »

Thanks to Evgeny Kotkov of Apache's Subversion Project, Apache 2.4.26 has a new inline compression module (mod_brotli) using Google's new Brotli compression library. We did not include any configuration sample for it so I'm posting one here.

This configuration uses brotli compression for browsers that have it (ltest Chrome and Firefox) and falls back to gzip (deflate) for browsers that don't and is the minimum to make it work. There are other options for both mod_brotli and mod_deflate for logging, compression quality, window, block size and others on it's documentation page, very similar to mod_deflate.

bro.exe has also been included with our distribution which is a command line application that will compress/uncompress files. This could be used to serve Brotli pre-compressed content for speed and lessen CPU usage when serving files.

Code: [Select]
<IfModule !brotli_module>
    LoadModule brotli_module modules/mod_brotli.so
</IfModule>
<IfModule !deflate_module>
    LoadModule deflate_module modules/mod_deflate.so
</IfModule>

# mod_filter needed for AddOutputFilterByType
<IfModule !filter_module>
    LoadModule filter_module modules/mod_filter.so
</IfModule>

AddOutputFilterByType BROTLI_COMPRESS;DEFLATE text/html text/plain text/css text/xml

# See http://httpd.apache.org/docs/2.4/mod/mod_brotli.html
# for available mod_brotli directives

# See http://httpd.apache.org/docs/2.4/mod/mod_deflate.html
# for available mod_deflate directives
Logged

puertoblack2003

  • Newbie
  • *
  • Offline Offline
  • Posts: 4
Re: mod_brotli sample configuration
« Reply #1 on: June 19, 2017, 08:42:28 PM »

this config ? do it goes with http or vhost files?
Logged

Gregg

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 839
Re: mod_brotli sample configuration
« Reply #2 on: June 22, 2017, 04:27:02 PM »

If you want it global (for all vhost) put it in httpd.conf. If you only want it used on certain sites, inside their vhosts configs. Might as well just go global with it.

Drupal uses pre-compressed css files and other webapps might as well, you wouldn't want it compressing those (double compressed) which a browser would never figure out.

That said, you configure globally, configuring it differently in a vhost will override global, htaccess will override it again. see http://httpd.apache.org/docs/2.4/configuring.html#scope

sorry for the late reply
Logged

puertoblack2003

  • Newbie
  • *
  • Offline Offline
  • Posts: 4
Re: mod_brotli sample configuration
« Reply #3 on: June 22, 2017, 11:52:40 PM »

thanks for the info.I'll give that suggestion a go.
Logged
Pages: [1]   Go Up
 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13