Mastodon nginx: simplify static files
This commit is contained in:
parent
20c5519e04
commit
2a389ab225
|
@ -73,7 +73,7 @@ server {
|
|||
# Fallback route.
|
||||
# Everything not routed should fall back to the SPA.
|
||||
location / {
|
||||
try_files /index.html /dev/null;
|
||||
try_files /dev/null @static-files;
|
||||
}
|
||||
|
||||
# Mastodon backend routes.
|
||||
|
@ -88,21 +88,12 @@ server {
|
|||
try_files $activitypub_location $activitypub_location;
|
||||
}
|
||||
|
||||
# Mastodon public files.
|
||||
# https://github.com/mastodon/mastodon/tree/main/public
|
||||
# Take only what we need for Soapbox.
|
||||
location ~ ^/(assets|favicon.(ico|png)|browserconfig.xml|embed.js|android-chrome-192x192.png|apple-touch-icon.png|(avatars|headers)/original/missing.png) {
|
||||
root /home/mastodon/live/public;
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
}
|
||||
|
||||
# Soapbox & Mastodon (frontend) build files.
|
||||
# New builds produce hashed filenames, so these should be cached heavily.
|
||||
location /packs {
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
try_files $uri @mastodon-public;
|
||||
try_files /dev/null @static-files;
|
||||
}
|
||||
|
||||
# Soapbox configuration files.
|
||||
|
@ -124,6 +115,12 @@ server {
|
|||
try_files $uri /index.html;
|
||||
}
|
||||
|
||||
# Soapbox & Mastodon static files.
|
||||
# Try Soapbox first, Mastodon, then fall back to the SPA.
|
||||
location @static-files {
|
||||
try_files $uri @mastodon-public;
|
||||
}
|
||||
|
||||
# Proxy to Mastodon's Ruby on Rails backend.
|
||||
location @proxy {
|
||||
proxy_set_header Host $host;
|
||||
|
|
Loading…
Reference in New Issue