diff --git a/ubuntu/molly.silvestris.systems.yml b/ubuntu/molly.silvestris.systems.yml index 5373b05..e97a599 100644 --- a/ubuntu/molly.silvestris.systems.yml +++ b/ubuntu/molly.silvestris.systems.yml @@ -10,6 +10,20 @@ - sendfile "on" - server_names_hash_bucket_size 512 nginx_sites: + munin.tenforward.social.http: + - listen *:80 + - listen [::]:80 + - server_name munin.tenforward.social + - return 301 "https://$host$request_uri" + munin.tenforward.social.https: + - listen *:443 ssl http2 + - listen [::]:443 ssl http2 + - server_name munin.tenforward.social + - root "/var/cache/munin/www" + - access_log "/var/log/nginx/munin.tenforward.social.access.log" + - error_log "/var/log/nginx/munin.tenforward.social.error.log" + - ssl_certificate "/etc/ssl/letsencrypt/munin.tenforward.social.crt" + - ssl_certificate_key "/etc/ssl/letsencrypt/munin.tenforward.social.pem" tenforward.social.http: - listen *:80 - listen [::]:80 @@ -35,71 +49,14 @@ - location / { try_files $uri @proxy; } - - location = /sw.js { - add_header Cache-Control "public, max-age=604800, must-revalidate"; - add_header Strict-Transport-Security "max-age=63072000; includeSubDomains"; - try_files $uri =404; - } - - location ~ ^/assets/ { - add_header Cache-Control "public, max-age=2419200, must-revalidate"; - add_header Strict-Transport-Security "max-age=63072000; includeSubDomains"; - try_files $uri =404; - } - - location ~ ^/avatars/ { - add_header Cache-Control "public, max-age=2419200, must-revalidate"; - add_header Strict-Transport-Security "max-age=63072000; includeSubDomains"; - try_files $uri =404; - } - - location ~ ^/emoji/ { - add_header Cache-Control "public, max-age=2419200, must-revalidate"; - add_header Strict-Transport-Security "max-age=63072000; includeSubDomains"; - try_files $uri =404; - } - - location ~ ^/headers/ { - add_header Cache-Control "public, max-age=2419200, must-revalidate"; - add_header Strict-Transport-Security "max-age=63072000; includeSubDomains"; - try_files $uri =404; - } - - location ~ ^/packs/ { - add_header Cache-Control "public, max-age=2419200, must-revalidate"; - add_header Strict-Transport-Security "max-age=63072000; includeSubDomains"; - try_files $uri =404; - } - - location ~ ^/shortcuts/ { - add_header Cache-Control "public, max-age=2419200, must-revalidate"; - add_header Strict-Transport-Security "max-age=63072000; includeSubDomains"; - try_files $uri =404; - } - - location ~ ^/sounds/ { - add_header Cache-Control "public, max-age=2419200, must-revalidate"; - add_header Strict-Transport-Security "max-age=63072000; includeSubDomains"; - try_files $uri =404; - } - - location ~ ^/system/ { - add_header Cache-Control "public, max-age=2419200, immutable"; - add_header Strict-Transport-Security "max-age=63072000; includeSubDomains"; - try_files $uri =404; - } - - location ^~ /api/v1/streaming { - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Proxy ""; - proxy_pass http://127.0.0.1:4000; - proxy_buffering off; - proxy_redirect off; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - add_header Strict-Transport-Security "max-age=63072000; includeSubDomains"; - tcp_nodelay on; + - location ~ ^/(emoji|packs|system/media_attachments/files|system/accounts/avatars) { + add_header Cache-Control "public, max-age=31536000, immutable"; } - location @proxy { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Proto https; proxy_set_header Proxy ""; proxy_pass_header Server; proxy_pass http://127.0.0.1:3000; @@ -110,12 +67,27 @@ proxy_set_header Connection $connection_upgrade; proxy_cache CACHE; proxy_cache_valid 200 7d; - proxy_cache_valid 410 24h; proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; add_header X-Cached $upstream_cache_status; + add_header Strict-Transport-Security max-age=31536000; + add_header Referrer-Policy "no-referrer, strict-origin-when-cross-origin"; tcp_nodelay on; } - - error_page 404 500 501 502 503 504 /500.html + - location /api/v1/streaming { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_pass http://127.0.0.1:4000; + proxy_buffering off; + proxy_redirect off; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + tcp_nodelay on; + } + - error_page 500 501 502 503 504 /500.html + nginx_configs: gzip: - gzip on