1.在ide中运行npm run build:prod
生成dist文件夹
2.下载ngix,解压后删除html中的内容
将dist文件夹中的内容拷贝到ngix中的html
3.为了防止刷新后找不到路径
找到ngix下的conf文件夹,在nginx.conf中编辑,按地方新增第三行的内容。
location / {
root html;
try_files $uri $uri/ /index.html last;
index index.html index.htm;
}
4.完成后双击运行ngix即可打开前端网站
如果想要重启nginx,在服务中杀掉进程后重新打开就可以了。