| 1234567891011121314151617181920212223242526272829303132 |
- server {
- listen 80;
- server_name _;
- root /usr/share/nginx/html;
- index index.html;
- # Vue Router history 模式:所有路径回退到 index.html
- location / {
- try_files $uri $uri/ /index.html;
- }
- # 静态资源长缓存
- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|ttf|eot)$ {
- expires 30d;
- add_header Cache-Control "public, immutable";
- }
- # gzip 压缩
- gzip on;
- gzip_vary on;
- gzip_min_length 1024;
- gzip_types
- text/plain
- text/css
- text/xml
- text/javascript
- application/javascript
- application/json
- application/xml
- application/xml+rss
- image/svg+xml;
- }
|