aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/nginx
diff options
context:
space:
mode:
authorMicah Elizabeth Scott <micah@misc.name>2018-08-22 14:34:41 -0700
committerChocobozzz <me@florianbigard.com>2018-08-24 09:08:33 +0200
commitb9ad99560546ff019a9a1e44c01a354c6fa291be (patch)
treeaa0e66a3afa45e5f2acb0729cea1b24d9559d5e7 /support/nginx
parentdd07afa5f448eed4ebc1afe1370dc6936b15f0d8 (diff)
downloadPeerTube-b9ad99560546ff019a9a1e44c01a354c6fa291be.tar.gz
PeerTube-b9ad99560546ff019a9a1e44c01a354c6fa291be.tar.zst
PeerTube-b9ad99560546ff019a9a1e44c01a354c6fa291be.zip
Add gzip support to the sample nginx configuration
Without gzip explicitly enabled, load times suffer from transferring over a megabyte of plaintext javascript. With gzip enabled, the bundle is down to about 300K, and loads much faster. This change does not enable gzip on files that are already compressed, so images, fonts, and videos will be sent without the CPU overhead.
Diffstat (limited to 'support/nginx')
-rw-r--r--support/nginx/peertube5
1 files changed, 5 insertions, 0 deletions
diff --git a/support/nginx/peertube b/support/nginx/peertube
index 01506c7aa..1b698576f 100644
--- a/support/nginx/peertube
+++ b/support/nginx/peertube
@@ -37,6 +37,11 @@ server {
37 # resolver $DNS-IP-1 $DNS-IP-2 valid=300s; 37 # resolver $DNS-IP-1 $DNS-IP-2 valid=300s;
38 # resolver_timeout 5s; 38 # resolver_timeout 5s;
39 39
40 # Enable compression for JS/CSS/HTML and JSON, for improved client load times
41 gzip on;
42 gzip_types text/plain text/css text/html application/javascript application/json;
43 gzip_vary on;
44
40 add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; 45 add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
41 46
42 access_log /var/log/nginx/peertube.example.com.access.log; 47 access_log /var/log/nginx/peertube.example.com.access.log;