-server {
- listen 80;
- listen [::]:80;
- server_name peertube.example.com;
-
- access_log /var/log/nginx/peertube.example.com.access.log;
- error_log /var/log/nginx/peertube.example.com.error.log;
-
- rewrite ^ https://$server_name$request_uri? permanent;
-}
-
-server {
- listen 443 ssl http2;
- listen [::]:443 ssl http2;
- server_name peertube.example.com;
-
- # For example with Let's Encrypt
- ssl_certificate /etc/letsencrypt/live/peertube.example.com/fullchain.pem;
- ssl_certificate_key /etc/letsencrypt/live/peertube.example.com/privkey.pem;
- ssl_trusted_certificate /etc/letsencrypt/live/peertube.example.com/chain.pem;
-
- access_log /var/log/nginx/peertube.example.com.access.log;
- error_log /var/log/nginx/peertube.example.com.error.log;
-
- location ^~ '/.well-known/acme-challenge' {
- default_type "text/plain";
- root /var/www/certbot;
- }
-
- location ~ ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$ {
- add_header Cache-Control "public, max-age=31536000, immutable";
-
- alias /var/www/peertube/peertube-latest/client/dist/$1;
- }
-
- location ~ ^/static/(thumbnails|avatars)/(.*)$ {
- add_header Cache-Control "public, max-age=31536000, immutable";
-
- alias /var/www/peertube/storage/$1/$2;
- }
-
- location / {
- proxy_pass http://localhost:9000;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header Host $host;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-
- # For the video upload
- client_max_body_size 8G;
- proxy_connect_timeout 600;
- proxy_send_timeout 600;
- proxy_read_timeout 600;
- send_timeout 600;
- }