nginx打包项目
1.yarn build
打包完成有一个dist文件夹
ngnix -->conf -->打开nginx.conf–> 改root
刷新出现404问题:
ngnix -->conf -->打开nginx.conf–> 添加路由信息
出现500报错
ngnix -->conf -->打开nginx.conf–> 修改
总的修改nginx.conf的信息:
location/ {
root C:\Users\17542\Desktop\project-v2\dist; #dist文件路径
index index.html index.html;
try_files $uri $uri/@router; #解决页面刷新404的问题
}
location @router {
rewrite ^.*$ /index.html last; #解决500报错的问题
}
检查文件的配置是否成功: nginx -t -c +nginx.conf配置文件
启动命令 start nginx
项目重点关注的:
1、api的封装
2、 模块化思想
3 、表格数据的处理
4、axios的二次封装
5、校验方法