赞
踩
1、使用package 打成jar包
2、将jar包放到搭建好的liunx服务器下(根据自己来规定所放位置)
cd /opt/ciss/www/project/
3、可以自己编辑执行脚本start.sh(可不用)也可使用java -jar来执行不过可能需要装jdk
- #一些常量
- PORT=8011
- APP_NAME=springboot_thymeleaf_shiro-0.0.1-SNAPSHOT.jar
- CUR_PATH=$pwd
- #配置文件所在目录
- APPFILE_PATH="-Dspring.config.location=/opt/ciss/www/project/config/"
-
-
- #第一步先杀死占用后端端口的进程,一般后端端口是8011,对应下句port的值
- echo "端口号为${PORT}"
- echo "启动jar包名称:${APP_NAME}"
- echo "启动资源路径:${APPFILE_PATH}"
- #根据端口号查找出响应进程id
- pid=$(netstat -nlp | grep :$PORT | awk '{print $7}' | awk -F "/" '{print $1}')
- echo "端口号对应进程id,pid=${pid}"
-
- #杀掉pid对应的进程
- if [ -n "$pid" ]; then
- kill -9 $pid;
- fi
- echo "杀死pid对应进程"
-
- #运行项目,打印日志
- nohup java -jar $APPFILE_PATH $APP_NAME > nohup.out &
- tail -f nohup.out
- echo "--------------------------------"

4、可以将java中的application也在外部做配置(可不用)
- server.port=8011
-
-
- ################################### mvc #########################################
- spring.thymeleaf.cache=false
- spring.thymeleaf.suffix=.html
- spring.mvc.view.prefix=classpath:/templates/
-
- ################################### mybatis-plus #########################################
- mybatis-plus.type-aliases-package=com.baizhi.entity, com.dc.entity
- mybatis-plus.mapper-locations=classpath:com/dc/mapper/*.xml,classpath:com/**/mapper/*.xml
-
- #配置mybatis日志
- mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
- #是否开启驼峰命名规则
- mybatis-plus.configuration.map-underscore-to-camel-case=false
-
- logging.level.com.baizhi.dao=debug
-
-
- ################################### servlet #########################################
- spring.servlet.multipart.max-file-size= 100MB
- spring.servlet.multipart.max-request-size= 200MB
-
- ################################### redis #########################################
- spring.redis.host=localhost
- spring.redis.port=6379
-
- spring.redis.database=0
- # 连接池最大连接数(使用负值表示没有限制)
- spring.redis.jedis.pool.max-active=200
- # 连接池最大阻塞等待时间(使用负值表示没有限制)
- spring.redis.jedis.pool.max-wait=-1
- # 连接池中的最大空闲连接
- spring.redis.jedis.pool.max-idle=10
- # 连接池中的最小空闲连接
- spring.redis.jedis.pool.min-idle=0
- spring.redis.timeout=1000
-
- ################################### ftp #########################################
- ftp.name=zys
- ftp.password=123456
- ftp.host=47.108.200.16
- ftp.port=21
-
- ftp.baseDir=C:/mtMulti/temp/
- #ftp.baseDir=/www/wwwroot/zys
- ################################## mysql ########################################
- medical.captcha-on-off=true
- medical.captcha-type=char
- spring.datasource.dynamic.primary=db1
- spring.datasource.dynamic.strict=false
- spring.datasource.dynamic.datasource.db1.url=jdbc:mysql://localhost:3306/mtdb?characterEncoding=UTF-8&serverTimezone=GMT
- spring.datasource.dynamic.datasource.db1.username=root
- spring.datasource.dynamic.datasource.db1.password=123456
- spring.datasource.dynamic.datasource.db1.driver-class-name=com.mysql.jdbc.Driver

5、最后运行脚本文件即可
./start.sh
1、安装nginx(百度)
2、打包vue项目
npm run bulid
3、使用上面语句,将前端打包成dist文件,然后上传生成的dist文件
4、配置nginx
找到nginx的配置文件nginx.conf,并配置关键代码
- listen 8081;
- server_name 192.168.129.44;
-
- #charset koi8-r;
-
- #access_log logs/host.access.log main;
-
- location / {
- root ;
- index index.html index.htm;
- }
然后运行nginx即可
找到nginx安装目录
which nginx
- 查询进程是否存在
- ps -ef|grep nginx
-
- 杀死进程
- kill -QUIT 进程号
-
- 进入到nginx,操作nginx
- cd /usr/local/nginx/sbin/
- ./nginx
- ./nginx -s stop
- ./nginx -s quit
- ./nginx -s reload
数据库启动内容可看Linux查看mysql是否启动+mysql启动(全)_叶落无痕123的博客-CSDN博客_linux查看mysql
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。