Explorar el Código

feat: 添加nginx.conf

husenlin hace 1 mes
padre
commit
9e7caf94a7
Se han modificado 1 ficheros con 27 adiciones y 0 borrados
  1. 27 0
      frontend/nginx.conf

+ 27 - 0
frontend/nginx.conf

@@ -0,0 +1,27 @@
+server {
+    listen 80;
+    server_name localhost;
+
+    # 静态文件根目录
+    root /usr/share/nginx/html;
+    index index.html;
+
+    # 禁用缓存
+    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
+        add_header Cache-Control "no-cache, no-store, must-revalidate";
+        add_header Pragma "no-cache";
+        add_header Expires "0";
+        try_files $uri $uri/ =404;
+    }
+
+    # 处理单页应用路由
+    location / {
+        try_files $uri $uri/ /index.html;
+    }
+
+    error_page 404 /index.html;
+    error_page 500 502 503 504 /50x.html;
+    location = /50x.html {
+        root /usr/share/nginx/html;
+    }
+}