瀏覽代碼

Add file uploads 10/...

Visman 2 年之前
父節點
當前提交
d8f5715d0f
共有 3 個文件被更改,包括 26 次插入5 次删除
  1. 1 1
      .dist.htaccess
  2. 23 3
      nginx.dist.conf
  3. 2 1
      public/.dist.htaccess

+ 1 - 1
.dist.htaccess

@@ -44,7 +44,7 @@ AddDefaultCharset UTF-8
 
 
 # Set Cache-Control header for caching statics
 # Set Cache-Control header for caching statics
 <ifModule mod_headers.c>
 <ifModule mod_headers.c>
-  <FilesMatch "\.(css|js|gif|png|jpg|jpeg|webp|woff|woff2)$">
+  <FilesMatch "\.(css|js|gif|png|jpg|jpeg|webp|avif|woff|woff2)$">
     Header set Cache-Control "public,max-age=31536000,immutable"
     Header set Cache-Control "public,max-age=31536000,immutable"
     Header unset ETag
     Header unset ETag
   </FilesMatch>
   </FilesMatch>

+ 23 - 3
nginx.dist.conf

@@ -48,7 +48,7 @@ server {
             return 404;
             return 404;
         }
         }
 
 
-        location ~ \.(css|js|gif|png|jpg|jpeg|webp|woff|woff2)$ {
+        location ~ \.(css|js|gif|png|jpg|jpeg|webp|avif|woff|woff2)$ {
             try_files $uri =404;
             try_files $uri =404;
 
 
             add_header Cache-Control "public,max-age=31536000,immutable";
             add_header Cache-Control "public,max-age=31536000,immutable";
@@ -68,7 +68,7 @@ server {
             return 404;
             return 404;
         }
         }
 
 
-        location ~ \.(css|js|gif|png|jpg|jpeg|webp|woff|woff2)$ {
+        location ~ \.(css|js|gif|png|jpg|jpeg|webp|avif|woff|woff2)$ {
             try_files $uri =404;
             try_files $uri =404;
 
 
             add_header Cache-Control "public,max-age=31536000,immutable";
             add_header Cache-Control "public,max-age=31536000,immutable";
@@ -88,7 +88,27 @@ server {
             return 404;
             return 404;
         }
         }
 
 
-        location ~ \.(css|js|gif|png|jpg|jpeg|webp|woff|woff2)$ {
+        location ~ \.(css|js|gif|png|jpg|jpeg|webp|avif|woff|woff2)$ {
+            try_files $uri =404;
+
+            add_header Cache-Control "public,max-age=31536000,immutable";
+            etag off;
+        }
+    }
+
+    location /upload/ {
+        location ~ ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ {
+            try_files $1.$2 =404;
+
+            add_header Cache-Control "public,max-age=31536000,immutable";
+            etag off;
+        }
+
+        location ~ /\.ht {
+            return 404;
+        }
+
+        location ~ \.(css|js|gif|png|jpg|jpeg|webp|avif|woff|woff2)$ {
             try_files $uri =404;
             try_files $uri =404;
 
 
             add_header Cache-Control "public,max-age=31536000,immutable";
             add_header Cache-Control "public,max-age=31536000,immutable";

+ 2 - 1
public/.dist.htaccess

@@ -16,6 +16,7 @@ AddDefaultCharset UTF-8
   RewriteCond %{REQUEST_URI} !^/style/
   RewriteCond %{REQUEST_URI} !^/style/
   RewriteCond %{REQUEST_URI} !^/img/
   RewriteCond %{REQUEST_URI} !^/img/
   RewriteCond %{REQUEST_URI} !^/js/
   RewriteCond %{REQUEST_URI} !^/js/
+  RewriteCond %{REQUEST_URI} !^/upload/
   RewriteCond %{REQUEST_URI} !^/favicon\.ico$
   RewriteCond %{REQUEST_URI} !^/favicon\.ico$
   RewriteCond %{REQUEST_URI} !^/robots\.txt$
   RewriteCond %{REQUEST_URI} !^/robots\.txt$
   RewriteRule . index.php [L]
   RewriteRule . index.php [L]
@@ -36,7 +37,7 @@ AddDefaultCharset UTF-8
 
 
 # Set Cache-Control header for caching statics
 # Set Cache-Control header for caching statics
 <ifModule mod_headers.c>
 <ifModule mod_headers.c>
-  <FilesMatch "\.(css|js|gif|png|jpg|jpeg|webp|woff|woff2)$">
+  <FilesMatch "\.(css|js|gif|png|jpg|jpeg|webp|avif|woff|woff2)$">
     Header set Cache-Control "public,max-age=31536000,immutable"
     Header set Cache-Control "public,max-age=31536000,immutable"
     Header unset ETag
     Header unset ETag
   </FilesMatch>
   </FilesMatch>