| 1234567891011121314151617181920212223242526272829303132 |
- 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;
- }
- location /web {
- alias /usr/share/nginx/html;
- try_files $uri $uri/ /web/index.html; #解决页面刷新404问题
- }
- error_page 404 /index.html;
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /usr/share/nginx/html;
- }
- }
|