]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/nginx/peertube-https
Fix http token interceptor
[github/Chocobozzz/PeerTube.git] / support / nginx / peertube-https
CommitLineData
c97eea23
C
1server {
2 listen 80;
3 # listen [::]:80;
4 server_name domain.tld;
5 rewrite ^ https://$server_name$request_uri? permanent;
6}
7
8server {
85cd9bde
C
9 listen 443 ssl http2;
10 # listen [::]:443 ssl http2;
c97eea23
C
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
aa83bcce 25 client_max_body_size 2G;
7e9334c3
C
26 proxy_connect_timeout 600;
27 proxy_send_timeout 600;
28 proxy_read_timeout 600;
c97eea23
C
29 }
30
31 # Bypass PeerTube webseed route for better performances
32 location /static/webseed {
85cd9bde
C
33 # Clients usually have 4 simultaneous webseed connections, so the real limit is 3MB/s per client
34 limit_rate 800k;
35
c97eea23
C
36 if ($request_method = 'OPTIONS') {
37 add_header 'Access-Control-Allow-Origin' '*';
38 add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
39 add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
40 add_header 'Access-Control-Max-Age' 1728000;
41 add_header 'Content-Type' 'text/plain charset=UTF-8';
42 add_header 'Content-Length' 0;
43 return 204;
44 }
45
46 if ($request_method = 'GET') {
47 add_header 'Access-Control-Allow-Origin' '*';
48 add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
49 add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
50 }
51
52 alias /your/installation/PeerTube/videos;
53 }
54
55 # Websocket tracker
56 location /tracker/socket {
57 # Peers send a message to the tracker every 15 minutes
58 # Don't close the websocket before this time
59 proxy_read_timeout 1200s;
60 proxy_set_header Upgrade $http_upgrade;
61 proxy_set_header Connection "upgrade";
62 proxy_http_version 1.1;
63 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
64 proxy_set_header Host $host;
65 proxy_pass http://localhost:9000;
66 }
67}