springboot+vue项目部署配置开机自启动

1.前端部属

下载nginx解压,在nginx\conf下找到nginx.conf

添加如下代码

java 复制代码
server {
		 listen       8081;
		 server_name  localhost;
	  charset utf-8;
	 
	  location / {
			 root   F:/1ceshi/dist;  #前端打包路径
	   try_files $uri $uri/ /index.html;
			 index  index.html index.htm;
		 }
	  
	  location /prod-api/ {
	   proxy_set_header Host $http_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;
	   proxy_pass http://localhost:8082/; #后台地址
	  }
	 
		 error_page   500 502 503 504  /50x.html;
		 location = /50x.html {
			 root   html;
		 }
	 }

2.后端部署

jdk安装完成配置好环境变量,配置环境变量方法请移步jdk环境变量配置-CSDN博客

找到C:\Program Files\Zulu\zulu-8\bin目录下,复制javaw.exe并重命名1ceshi.exe(自定义)

后端项目打好jar包。

3.编写脚本

新建 重启.bat,内容如下:

java 复制代码
@echo off
taskkill /f /t /im "1ceshi.exe"

taskkill /f /t /im nginx.exe

timeout /t 1
#1ceshi 是jdk中复制的javaw.exe重命名文件
#F:\1ceshi\yizhuan.jar 是打包好的jar包
start 1ceshi -Xms2048m -Xmx4096m -Dfile.encoding=UTF-8  -jar F:\1ceshi\yizhuan.jar
timeout /t 10
echo ------------success!-------------------- 
#nginx路径
cd /d F:\1ceshi\nginx
nginx.exe

新建 停止.bat,内容如下:

java 复制代码
taskkill /f /t /im "1ceshi.exe"

taskkill /f /t /im nginx.exe

4.测试

双击重启.bat

启动成功。

访问http://localhost:8081/

这样就好了。

说明:用javaw.exe的原因是可后台运行

windows配置开机自启很简单了,请查看配置开机自启-CSDN博客

相关推荐
KYGALYX1 小时前
服务异步通信
开发语言·后端·微服务·ruby
掘了1 小时前
「2025 年终总结」在所有失去的人中,我最怀念我自己
前端·后端·年终总结
爬山算法2 小时前
Hibernate(90)如何在故障注入测试中使用Hibernate?
java·后端·hibernate
猫头虎2 小时前
如何排查并解决项目启动时报错Error encountered while processing: java.io.IOException: closed 的问题
java·开发语言·jvm·spring boot·python·开源·maven
Moment2 小时前
富文本编辑器在 AI 时代为什么这么受欢迎
前端·javascript·后端
吹牛不交税3 小时前
admin.net-v2 框架使用笔记-netcore8.0/10.0版
vue.js·.netcore
Cobyte3 小时前
AI全栈实战:使用 Python+LangChain+Vue3 构建一个 LLM 聊天应用
前端·后端·aigc
程序员侠客行4 小时前
Mybatis连接池实现及池化模式
java·后端·架构·mybatis
Honmaple4 小时前
QMD (Quarto Markdown) 搭建与使用指南
后端
MZ_ZXD0014 小时前
springboot旅游信息管理系统-计算机毕业设计源码21675
java·c++·vue.js·spring boot·python·django·php