1、安装Nginx,并开启
2、前端项目打包:npm run build:prod--->dist
3、后端项目打包:install--->xxx.jar
4、开放需要的端口号:比如我的后端项目端口号为8282,则需要防火墙和服务器同时开发8282端口
5、将dist上传到nginx/html文件夹
6、将jar文件上传到服务器任意文件夹下
7、配置nginx文件
在nginx/conf/nginx.conf文件中配置
server{listen 80;server_name localhost;location / {root /usr/local/nginx/html;index index.html;}location /prod-api/ {proxy_pass http://62.234.175.16:8282/;}
}