### Nginx部署项目
1、yarn build打包Vue项目
2、打开nginx.conf文件,配置对应的信息
# nginx.conf:
location / {
root C:\Users\17542\Desktop\project-v2\dist;
index index.html index.htm;
try_files $uri $uri/ @router; #解决页面刷新404问题
}
location @router {
rewrite ^.*$/index.html last; # Vue项目路由不是真实存在的
}
3、检查配置文件是否配置成功
cmd:
nginx -t -c D: \nginx-1.16.1\conf\nginx.conf #测试
start nginx #运行nginx