server{ # 监听的端口号 listen 80; # 服务名称 生产环境要修改成 公网ip 如 47.105.134.120 server_name localhost; # 配置根目录的地址是以 nginx 下的 html 文件夹为根目录来查找的 root /usr/share/nginx/html; ## html不缓存 location = /index.html { add_header Cache-Control "no-cache, no-store"; } location / { root /usr/share/nginx/html; try_files $uri $uri/ /index.html; } location @router { rewrite ^.*$ /index.html last; } }