Răsfoiți Sursa

更新 'nginx.conf'

git-admin 1 an în urmă
părinte
comite
55d69e3eea
1 a modificat fișierele cu 15 adăugiri și 12 ștergeri
  1. 15 12
      nginx.conf

+ 15 - 12
nginx.conf

@@ -19,21 +19,24 @@ http {
         listen       80;
         server_name  localhost;
 
+        gzip on;
+        gzip_min_length 1k;
+        gzip_comp_level 9;
+        gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
+        gzip_vary on;
 
         location / {
-        	rewrite '^/(.*)\.br$' /br?channelCode=$1 permanent;
-			root /usr/share/nginx/html; #配置Vue项目根路径,与
-			index index.html index.html; #配置首页
-			try_files $uri $uri/ /index.html; #防止刷新报404
+            root   /usr/share/nginx/html;
+            try_files $uri $uri/ @router;
+            index  index.html index.htm;
+            error_page 405 =200 http://$host$request_uri;
         }
-
-        #error_page 404 /404.html;
-            #location = /40x.html {
-        #}
-
-        error_page 500 502 503 504 /50x.html;
-            location = /50x.html {
-			root html;
+        location @router {
+            rewrite ^.*$ /index.html last;
+        }
+        error_page   500 502 503 504  /50x.html;
+        location = /50x.html {
+            root   html;
         }
     }
  }