springboot-vue整合-部署到 linux

  1. vue编译后生成的文件放到static文件夹下(或配置静态文件访问的路径文件夹下),index.html放到templates文件下。如图

2.pom.xml中添加thymeleaf模板依赖,否则controller控制的页面跳转找不到templates下的index.html;

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

3. idea 打包成jar

4. 生成的jar

5.window上运行jar,在生成的jar文件夹下运行cmd命令

6.在linux上运行jar,将生成jar文件夹放到linux上的home目录下,

7.在jar目录下执行命令 :nohup java -jar qbgs.jar &(日志默认输出在该目录下的nohup.out文件中)

(指定端口号及日志输出位置:nohup  java  -jar  -Dserver.port=8099  qbgs.jar  >  log.log & )

nohup: 命令的作用就是让程序在后台运行,不用担心关闭连接进程断掉的问题运行日志在目录下的nohup.out中

注意:不要漏掉命令结尾的“&”,否则ctrl + c 结束命令后程序就被关闭(踩过的坑)

8.关闭linux上正在运行的jar

查看进程并kill

ps aux|grep getCimiss-surf.jar

Kill -9 进程ID

猜你喜欢

转载自www.cnblogs.com/L237/p/12382427.html
今日推荐