4 server_name domain.tld;
6 location /.well-known/acme-challenge/ { allow all; }
7 location / { return 301 https://$host$request_uri; }
12 # listen [::]:443 ssl http2;
13 server_name domain.tld;
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;
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;
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;
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
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;
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';
54 alias /home/peertube/storage/videos;
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;