mirror of
https://github.com/jakejarvis/mastodon-utils.git
synced 2025-04-26 07:55:22 -04:00
send fewer requests for static files to the backend
This commit is contained in:
parent
30f958e1c5
commit
07f3d6fa8b
@ -63,11 +63,6 @@ server {
|
|||||||
font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon
|
font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon
|
||||||
image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml;
|
image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml;
|
||||||
|
|
||||||
# add shortcut to public Grafana dashboard
|
|
||||||
location ~ ^/dashboard/?$ {
|
|
||||||
return 302 https://grafana.pipe.fail/public-dashboards/b5ca7a7c8e844f90b0973d2ab02bad0a;
|
|
||||||
}
|
|
||||||
|
|
||||||
# sends most paths to the backend proxy and ignores the location blocks below, except if
|
# sends most paths to the backend proxy and ignores the location blocks below, except if
|
||||||
# the file exists in /home/mastodon/live
|
# the file exists in /home/mastodon/live
|
||||||
location / {
|
location / {
|
||||||
@ -76,7 +71,7 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# condensed version of original Mastodon nginx.conf
|
# condensed version of original Mastodon nginx.conf
|
||||||
location ~ ^/(assets|avatars|emoji|headers|packs|shortcuts|sounds)/ {
|
location ~ ^/(?:assets|avatars|emoji|headers|packs|shortcuts|sounds)/ {
|
||||||
add_header Cache-Control "public, max-age=2419200, must-revalidate"; # 28 days
|
add_header Cache-Control "public, max-age=2419200, must-revalidate"; # 28 days
|
||||||
add_header Strict-Transport-Security "max-age=63072000" always;
|
add_header Strict-Transport-Security "max-age=63072000" always;
|
||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
@ -89,11 +84,11 @@ server {
|
|||||||
try_files $uri =404;
|
try_files $uri =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
# static files in root of /public (sw.js, favicon.ico, etc) that aren't covered above
|
# static files *only in the root* of /public (/favicon.ico, /sw.js, /robots.txt, etc.)
|
||||||
location ~ ^/(.*\.(js|css|png|gif|jpg|txt|ico))$ {
|
location ~ ^/[^/]+\.(?:js|css|png|gif|jpg|txt|ico)$ {
|
||||||
add_header Cache-Control "public, max-age=604800, must-revalidate"; # 7 days
|
add_header Cache-Control "public, max-age=604800, must-revalidate"; # 7 days
|
||||||
add_header Strict-Transport-Security "max-age=63072000" always;
|
add_header Strict-Transport-Security "max-age=63072000" always;
|
||||||
try_files $uri @proxy;
|
try_files $uri =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ^~ /api/v1/streaming {
|
location ^~ /api/v1/streaming {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user