aboutsummaryrefslogtreecommitdiffhomepage
path: root/support/nginx/peertube-https
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-25 14:20:00 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-25 14:21:41 +0100
commitc97eea23d759e72de903aa8533cf9fce04fb7174 (patch)
treeef9f57a1cca53d5f903a7358e1ec45f6f6dfebe6 /support/nginx/peertube-https
parentfe6445bf97082d9834fcd1ba5ddadde4635e6730 (diff)
downloadPeerTube-c97eea23d759e72de903aa8533cf9fce04fb7174.tar.gz
PeerTube-c97eea23d759e72de903aa8533cf9fce04fb7174.tar.zst
PeerTube-c97eea23d759e72de903aa8533cf9fce04fb7174.zip
Add peertube https nginx template
Diffstat (limited to 'support/nginx/peertube-https')
-rw-r--r--support/nginx/peertube-https61
1 files changed, 61 insertions, 0 deletions
diff --git a/support/nginx/peertube-https b/support/nginx/peertube-https
new file mode 100644
index 000000000..e0d8c483d
--- /dev/null
+++ b/support/nginx/peertube-https
@@ -0,0 +1,61 @@
1server {
2 listen 80;
3 # listen [::]:80;
4 server_name domain.tld;
5 rewrite ^ https://$server_name$request_uri? permanent;
6}
7
8server {
9 listen 443 ssl spdy; # or http2
10 # listen [::]:443;
11 server_name domain.tld;
12
13 # For example with Let's Encrypt
14 ssl_certificate /etc/letsencrypt/live/domain.tld/fullchain.pem;
15 ssl_certificate_key /etc/letsencrypt/live/domain.tld/privkey.pem;
16 ssl_trusted_certificate /etc/letsencrypt/live/domain.tld/chain.pem;
17
18 location / {
19 proxy_pass http://localhost:9000;
20 proxy_set_header X-Real-IP $remote_addr;
21 proxy_set_header Host $host;
22 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
23
24 # For the video upload
25 client_max_body_size 100m;
26 }
27
28 # Bypass PeerTube webseed route for better performances
29 location /static/webseed {
30 if ($request_method = 'OPTIONS') {
31 add_header 'Access-Control-Allow-Origin' '*';
32 add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
33 add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
34 add_header 'Access-Control-Max-Age' 1728000;
35 add_header 'Content-Type' 'text/plain charset=UTF-8';
36 add_header 'Content-Length' 0;
37 return 204;
38 }
39
40 if ($request_method = 'GET') {
41 add_header 'Access-Control-Allow-Origin' '*';
42 add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
43 add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
44 }
45
46 alias /your/installation/PeerTube/videos;
47 }
48
49 # Websocket tracker
50 location /tracker/socket {
51 # Peers send a message to the tracker every 15 minutes
52 # Don't close the websocket before this time
53 proxy_read_timeout 1200s;
54 proxy_set_header Upgrade $http_upgrade;
55 proxy_set_header Connection "upgrade";
56 proxy_http_version 1.1;
57 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
58 proxy_set_header Host $host;
59 proxy_pass http://localhost:9000;
60 }
61}