]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/nginx/peertube
Remove npm run upgrade
[github/Chocobozzz/PeerTube.git] / support / nginx / peertube
CommitLineData
c97eea23
C
1server {
2 listen 80;
3 # listen [::]:80;
4 server_name domain.tld;
d2000ca6
C
5
6 location /.well-known/acme-challenge/ { allow all; }
7 location / { return 301 https://$host$request_uri; }
c97eea23
C
8}
9
10server {
85cd9bde
C
11 listen 443 ssl http2;
12 # listen [::]:443 ssl http2;
c97eea23
C
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
aa83bcce 27 client_max_body_size 2G;
7e9334c3
C
28 proxy_connect_timeout 600;
29 proxy_send_timeout 600;
30 proxy_read_timeout 600;
c97eea23
C
31 }
32
33 # Bypass PeerTube webseed route for better performances
34 location /static/webseed {
85cd9bde
C
35 # Clients usually have 4 simultaneous webseed connections, so the real limit is 3MB/s per client
36 limit_rate 800k;
37
c97eea23
C
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
d2000ca6 54 alias /home/peertube/storage/videos;
c97eea23
C
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}