Vue3+TS+Vite项目部署(Windows10)
1、项目打包
npm run build
生成dist文件
2、安装和配置nginx
官网下载安装包,cmd命令运行,将dist拷贝到html文件下,详情可见:https://www.cnblogs.com/taiyonghai/p/9402734.html
重点在于nginx.conf的配置
listen 8083;
server_name 183.168.98.105;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html/dist;
index index.html index.htm;
if (!-e $request_filename) {
rewrite ^/(.*) /index.html last;
break;
}
}
location ^~/api {
rewrite ^/api/(.*)$ /$1 break; #重置api
proxy_pass http://218.199.2.33:8080; #****后端接口地址
}