diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-15 17:56:58 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-15 18:07:08 +0100 |
commit | d2000ca6e7fa77758d4f811e4a8af11108d2655d (patch) | |
tree | d40860d17f33eacd33f79780fab08ecb7e6e46a7 /support/nginx/peertube | |
parent | 53733ec2abd4b7588c85cdd37824b0082b46f188 (diff) | |
download | PeerTube-d2000ca6e7fa77758d4f811e4a8af11108d2655d.tar.gz PeerTube-d2000ca6e7fa77758d4f811e4a8af11108d2655d.tar.zst PeerTube-d2000ca6e7fa77758d4f811e4a8af11108d2655d.zip |
Update production guide
Use release that already contains build files. It requires a specific
directories tree but I think it would be fine.
Diffstat (limited to 'support/nginx/peertube')
-rw-r--r-- | support/nginx/peertube | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/support/nginx/peertube b/support/nginx/peertube new file mode 100644 index 000000000..f7be64424 --- /dev/null +++ b/support/nginx/peertube | |||
@@ -0,0 +1,69 @@ | |||
1 | server { | ||
2 | listen 80; | ||
3 | # listen [::]:80; | ||
4 | server_name domain.tld; | ||
5 | |||
6 | location /.well-known/acme-challenge/ { allow all; } | ||
7 | location / { return 301 https://$host$request_uri; } | ||
8 | } | ||
9 | |||
10 | server { | ||
11 | listen 443 ssl http2; | ||
12 | # listen [::]:443 ssl http2; | ||
13 | server_name domain.tld; | ||
14 | |||
15 | # For example with Let's Encrypt | ||
16 | ssl_certificate /etc/letsencrypt/live/domain.tld/fullchain.pem; | ||
17 | ssl_certificate_key /etc/letsencrypt/live/domain.tld/privkey.pem; | ||
18 | ssl_trusted_certificate /etc/letsencrypt/live/domain.tld/chain.pem; | ||
19 | |||
20 | location / { | ||
21 | proxy_pass http://localhost:9000; | ||
22 | proxy_set_header X-Real-IP $remote_addr; | ||
23 | proxy_set_header Host $host; | ||
24 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
25 | |||
26 | # For the video upload | ||
27 | client_max_body_size 2G; | ||
28 | proxy_connect_timeout 600; | ||
29 | proxy_send_timeout 600; | ||
30 | proxy_read_timeout 600; | ||
31 | } | ||
32 | |||
33 | # Bypass PeerTube webseed route for better performances | ||
34 | location /static/webseed { | ||
35 | # Clients usually have 4 simultaneous webseed connections, so the real limit is 3MB/s per client | ||
36 | limit_rate 800k; | ||
37 | |||
38 | if ($request_method = 'OPTIONS') { | ||
39 | add_header 'Access-Control-Allow-Origin' '*'; | ||
40 | add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS'; | ||
41 | add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; | ||
42 | add_header 'Access-Control-Max-Age' 1728000; | ||
43 | add_header 'Content-Type' 'text/plain charset=UTF-8'; | ||
44 | add_header 'Content-Length' 0; | ||
45 | return 204; | ||
46 | } | ||
47 | |||
48 | if ($request_method = 'GET') { | ||
49 | add_header 'Access-Control-Allow-Origin' '*'; | ||
50 | 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'; | ||
52 | } | ||
53 | |||
54 | alias /home/peertube/storage/videos; | ||
55 | } | ||
56 | |||
57 | # Websocket tracker | ||
58 | location /tracker/socket { | ||
59 | # Peers send a message to the tracker every 15 minutes | ||
60 | # Don't close the websocket before this time | ||
61 | proxy_read_timeout 1200s; | ||
62 | proxy_set_header Upgrade $http_upgrade; | ||
63 | proxy_set_header Connection "upgrade"; | ||
64 | proxy_http_version 1.1; | ||
65 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
66 | proxy_set_header Host $host; | ||
67 | proxy_pass http://localhost:9000; | ||
68 | } | ||
69 | } | ||