项目部署 - Linux( springboot + vue + nginx)

Aba ·
更新时间:2024-09-20
· 588 次阅读

一、后台项目(Springboot) 1.项目打成jar包 在项目target目录里会有打包的jar

在这里插入图片描述
在这里插入图片描述

2.启动后台运行jar

注意: 若无nohup 命令 yum install coreutils

nohup java -jar 你的jar包名称.jar & 二、前端工程 1.点击此按钮进行打包

在这里插入图片描述

丢到服务器上去
在这里插入图片描述

三、配置nginx 前端工程 和后台api接口转发 server { listen 80; server_name 你自己的IP; #前端页面 location / { #Linux上的前端工程打包目录 root /home/dist/; #防止重定向页面刷新 路由失效 try_files $uri $uri/ /index.html; index index.jsp index.html index.htm; } #后台接口地址 location /api/{ proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; ##填写你接口地址和端口 利用 nginx 反向代理进行 服务转发 防止跨域 proxy_pass http://localhost:8080/; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; }
作者:_Sol_



VUE springboot 项目部 Linux Nginx

需要 登录 后方可回复, 如果你还没有账号请 注册新账号