diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-18 17:44:13 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-18 17:45:49 +0100 |
commit | 5668bf2e51051c809d84b809e2644358fa5fd287 (patch) | |
tree | d49d87b8ce2fd182c831a5cda337c1eeaa067a12 /support/nginx | |
parent | 3e5002477a7643b79aae98ce5e507a7aced6cb8f (diff) | |
download | PeerTube-5668bf2e51051c809d84b809e2644358fa5fd287.tar.gz PeerTube-5668bf2e51051c809d84b809e2644358fa5fd287.tar.zst PeerTube-5668bf2e51051c809d84b809e2644358fa5fd287.zip |
nginx optimizations
Diffstat (limited to 'support/nginx')
-rw-r--r-- | support/nginx/peertube | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/support/nginx/peertube b/support/nginx/peertube index f7be64424..8973f2f24 100644 --- a/support/nginx/peertube +++ b/support/nginx/peertube | |||
@@ -3,6 +3,9 @@ server { | |||
3 | # listen [::]:80; | 3 | # listen [::]:80; |
4 | server_name domain.tld; | 4 | server_name domain.tld; |
5 | 5 | ||
6 | access_log /var/log/nginx/peertube_access.log; | ||
7 | error_log /var/log/nginx/peertube_error.log; | ||
8 | |||
6 | location /.well-known/acme-challenge/ { allow all; } | 9 | location /.well-known/acme-challenge/ { allow all; } |
7 | location / { return 301 https://$host$request_uri; } | 10 | location / { return 301 https://$host$request_uri; } |
8 | } | 11 | } |
@@ -12,11 +15,26 @@ server { | |||
12 | # listen [::]:443 ssl http2; | 15 | # listen [::]:443 ssl http2; |
13 | server_name domain.tld; | 16 | server_name domain.tld; |
14 | 17 | ||
18 | access_log /var/log/nginx/peertube_access.log; | ||
19 | error_log /var/log/nginx/peertube_error.log; | ||
20 | |||
15 | # For example with Let's Encrypt | 21 | # For example with Let's Encrypt |
16 | ssl_certificate /etc/letsencrypt/live/domain.tld/fullchain.pem; | 22 | ssl_certificate /etc/letsencrypt/live/domain.tld/fullchain.pem; |
17 | ssl_certificate_key /etc/letsencrypt/live/domain.tld/privkey.pem; | 23 | ssl_certificate_key /etc/letsencrypt/live/domain.tld/privkey.pem; |
18 | ssl_trusted_certificate /etc/letsencrypt/live/domain.tld/chain.pem; | 24 | ssl_trusted_certificate /etc/letsencrypt/live/domain.tld/chain.pem; |
19 | 25 | ||
26 | location ~ ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$ { | ||
27 | add_header Cache-Control "public, max-age=31536000, immutable"; | ||
28 | |||
29 | alias /home/peertube/peertube-latest/client/dist/$1; | ||
30 | } | ||
31 | |||
32 | location ~ ^/static/(thumbnails|avatars|previews)/(.*)$ { | ||
33 | add_header Cache-Control "public, max-age=31536000, immutable"; | ||
34 | |||
35 | alias /home/peertube/storage/$1/$2; | ||
36 | } | ||
37 | |||
20 | location / { | 38 | location / { |
21 | proxy_pass http://localhost:9000; | 39 | proxy_pass http://localhost:9000; |
22 | proxy_set_header X-Real-IP $remote_addr; | 40 | proxy_set_header X-Real-IP $remote_addr; |
@@ -49,6 +67,9 @@ server { | |||
49 | add_header 'Access-Control-Allow-Origin' '*'; | 67 | add_header 'Access-Control-Allow-Origin' '*'; |
50 | add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS'; | 68 | add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS'; |
51 | add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; | 69 | add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; |
70 | |||
71 | # Don't spam access log file with byte range requests | ||
72 | access_log off; | ||
52 | } | 73 | } |
53 | 74 | ||
54 | alias /home/peertube/storage/videos; | 75 | alias /home/peertube/storage/videos; |