Improve client mobile version
[oweals/peertube.git] / support / nginx / peertube
1 server {
2   listen 80;
3   server_name domain.tld;
4
5   location / {
6     proxy_pass http://localhost:9000;
7     proxy_set_header X-Real-IP $remote_addr;
8     proxy_set_header Host $host;
9     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
10
11     # For the video upload
12     client_max_body_size 2G;
13   }
14
15   # Bypass PeerTube webseed route for better performances
16   location /static/webseed {
17     if ($request_method = 'OPTIONS') {
18       add_header 'Access-Control-Allow-Origin' '*';
19       add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
20       add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
21       add_header 'Access-Control-Max-Age' 1728000;
22       add_header 'Content-Type' 'text/plain charset=UTF-8';
23       add_header 'Content-Length' 0;
24       return 204;
25     }
26
27     if ($request_method = 'GET') {
28       add_header 'Access-Control-Allow-Origin' '*';
29       add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
30       add_header 'Access-Control-Allow-Headers' 'Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
31     }
32
33     alias /your/installation/PeerTube/videos;
34   }
35
36   # Websocket tracker
37   location /tracker/socket {
38     # Peers send a message to the tracker every 15 minutes
39     # Don't close the websocket before this time
40     proxy_read_timeout 1200s;
41     proxy_set_header Upgrade $http_upgrade;
42     proxy_set_header Connection "upgrade";
43     proxy_http_version 1.1;
44     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
45     proxy_set_header Host $host;
46     proxy_pass http://localhost:9000;
47   }
48 }