本文共 511 字,大约阅读时间需要 1 分钟。
因为spirng前后端分离设计,发布流程略有不同,前后端单独发布,通过nginx集成
1、前端项目打包
#转到前端项目根目录cd D:\001\myProject\GitHub\AG-Admin-v2-UI# 构建生成环境cnpm run build:prod
然后等待服务器build,如果成功后会提示
打包成功后的文件在dist目录,把文件拷贝到nginx根目录下html\dist
2、nginx配置
location / { # 指向我们打包后上传的前端文件 root html/dist; index index.html index.htm; } location /jwt/ { # 转发请求到后端服务网关 proxy_pass http://127.0.0.1:8765/jwt/; } location /api/ { proxy_pass http://127.0.0.1:8765/api/; }
3、重启nginx
转载地址:http://uthwi.baihongyu.com/