前端程序员将vue项目打包之后,将dist文件发送给我,记录部署宝塔过程。
上传目录
将dist目录上传至TP5后台项目文件夹中,与public同级
项目目录结构:
注:dist目录名已被我修改
配置nginx
server {listen 80;server_name h5.gasp.ydunicorn.store;root C:/wwwroot/gasp.ydunicorn.store/gasp_vue;location / {index index.html index.htm index.php;try_files $uri $uri/ @router; # 配置使用路由}error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}# 路由配置信息location @router {rewrite ^.*$ /index.html last;}# 代理服务端接口location /face {proxy_pass http://gasp.ydunicorn.store/h5_api/; #将真正的请求代理到API 服务地址}}
注:location /face face为vue代码中的接口路由设置中自己定义的,正常为/api
