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