vue+springBoot前后端分离项目,tomcat部署记录
nginx部署vue
- npm run build打包vue项目dist
- 将dist文件放到,nginx-html目录下
- 修改nginx.conf配置文件
server {
listen 80;
server_name localhost;
location /api/{
proxy_pass http://127.0.0.1:8088; #配置跨域
}
location / {
root D:\Nginx_1.23.0\html\dist;
index index.html index.htm;
try_files $uri $uri/ /index.html; #解决页面刷新404
}
}
start nginx
启动项目- 访问 localhost:80
常用命令:
nginx -v
查看版本
start nginx
启动
nginx -s stop
关闭
nginx -s reload
重启
运行springBoot
mvn clean package
打成jar包 xx.jarjava -jar xx.jar
运行
部署结束
访问成功~ 恭喜!