Skip to content

A self-hosted media server and file management system

feat: nginx and font caching

aminnausin53a35950933a
diff --git a/docker/etc/nginx/conf.d/default.conf b/docker/etc/nginx/conf.d/default.conf
index b96e4c1f..e0cb24c0 100644
--- a/docker/etc/nginx/conf.d/default.conf
+++ b/docker/etc/nginx/conf.d/default.conf
@@ -53,14 +53,20 @@ server {
location /storage/ {
location /storage/thumbnails/ {
+ add_header Cache-Control "public, max-age=604800, must-revalidate";
+ try_files $uri =404;
allow all;
}
location /storage/posters/ {
+ add_header Cache-Control "public, max-age=604800, must-revalidate";
+ try_files $uri =404;
allow all;
}
location /storage/previews/ {
+ add_header Cache-Control "public, max-age=604800, must-revalidate";
+ try_files $uri =404;
allow all;
}
@@ -69,4 +75,14 @@ server {
return 403;
}
}
+
+ location ~* \.(?:css|js|woff2?|ttf|eot|otf)$ {
+ add_header Cache-Control "public, max-age=604800, must-revalidate";
+ try_files $uri =404;
+ }
+
+ location ~* \.(?:ico|jpg|jpeg|png|gif|webp|svg)$ {
+ add_header Cache-Control "public, max-age=604800, must-revalidate";
+ try_files $uri =404;
+ }
}
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php
index 66e269c3..a3d4d173 100755
--- a/resources/views/layouts/app.blade.php
+++ b/resources/views/layouts/app.blade.php
@@ -24,6 +24,9 @@
window.addEventListener('resize', setVhUnit)
</script>
+ <link rel="preconnect" href="https://fonts.googleapis.com">
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
+
<!-- local -->
@vite('resources/css/app.css')
<style>