基本过程:
1.Linux服务器准备:
(1)安装配置Nginx:https://www.jianshu.com/writer#/notebooks/39075168/notes/51684088
(2)安装java环境:https://www.jianshu.com/writer#/notebooks/39075253/notes/51687788
2.项目多环境及打包:
具体参考本文集的另一篇文章《springboot多环境配置》:
https://www.jianshu.com/writer#/notebooks/38873309/notes/51748301
4.将jar包放到服务器上运行:
# 本地上传
scp <file> user@host:/<dirctory>
# 查看服务器上是否有Java进程
ps -ef|grep jar
# 强制停止进程
kill -9 <process>
# 运行jar包并将日志重定向到已经建好的日志文件中
nohup java -jar filename.jar > file.log
# 查找java进程
ps aux |grep *.jar
# 或者用
ps -ef|grep java