Skip to content

Commit

Permalink
Pre-compressed content usage config files
Browse files Browse the repository at this point in the history
Closes #231
  • Loading branch information
LeoColomb committed May 16, 2019
1 parent d7fc6c3 commit 8db768b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
6 changes: 0 additions & 6 deletions h5bp/web_performance/compression.conf
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,3 @@ gzip_types
text/vtt
text/x-component
text/x-cross-domain-policy;

# This should be turned on if you are going to have pre-compressed copies (.gz)
# of static files available. If not it should be left off as it will cause extra
# I/O for the check. It is best if you enable this in a `location` block for a
# specific directory, or on an individual `server` level.
# gzip_static on;
17 changes: 17 additions & 0 deletions h5bp/web_performance/pre-compressed_content_brotli.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ----------------------------------------------------------------------
# | Brotli pre-compressed content |
# ----------------------------------------------------------------------

# Serve brotli compressed files if they exist and if the client accepts brotli
# encoding.
#
# (!) To make this part relevant, you need to generate encoded files by your
# own. Enabling this part will not auto-generate brotlied files.
#
# Note that some clients (eg. browsers) require a secure connection to request
# brotli-compressed resources.
# https://www.chromestatus.com/feature/5420797577396224
#
# https://github.com/eustas/ngx_brotli/#brotli_static

brotli_static on;
13 changes: 13 additions & 0 deletions h5bp/web_performance/pre-compressed_content_gzip.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ----------------------------------------------------------------------
# | GZip pre-compressed content |
# ----------------------------------------------------------------------

# Serve gzip compressed files if they exist and if the client accepts gzip
# encoding.
#
# (!) To make this part relevant, you need to generate encoded files by your
# own. Enabling this part will not auto-generate gziped files.
#
# https://nginx.org/en/docs/http/ngx_http_gzip_static_module.html

gzip_static on;
2 changes: 1 addition & 1 deletion test/vhosts/server.localhost.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ server {
include h5bp/errors/custom_errors.conf;

location ~* /test-pre-gzip {
gzip_static on;
include h5bp/web_performance/pre-compressed_content_gzip.conf;
}
}

0 comments on commit 8db768b

Please sign in to comment.