上线部署
...大约 1 分钟商业版教程启动部署
上线部署
后台打包
mvn clean package -Pprod
- 将
platform-api.jar
、platform-admin.jar
上传到服务器,在同目录新增startPlatformAdminService.sh
、startPlatformApiService.sh
startPlatformAdminService.sh
(netstat -tlnp|grep 8888|awk '{print $7}'|awk -F '/' '{print $1}') |xargs kill -9
echo "................kill the process platform-admin.............................."
nohup java -Dloader.path=/home/lib/admin -jar platform-admin.jar &
sleep 5s
tail -f /home/logs/platform-admin/info.log
startPlatformApiService.sh
(netstat -tlnp|grep 8889|awk '{print $7}'|awk -F '/' '{print $1}') |xargs kill -9
echo "................kill the process platform-api.............................."
nohup java -Dloader.path=/home/lib/api -jar platform-api.jar &
sleep 5s
tail -f /home/logs/platform-api/info.log
- 启动脚本赋权
chmod 755 startPlatformAdminService.sh
chmod 755 startPlatformApiService.sh
- 分别执行启动脚本
./startPlatformAdminService.sh
./startPlatformApiService.sh
后台管理系统前端打包
- 修改后台请求配置
platform-admin-ui\static\config\index-prod.js
里的window.SITE_CONFIG['baseUrl']
- 打包
npm run build
- 将dist文件夹上传到服务器,例目录为: /data/dist/
参考配置nginx
server {
listen 80;
server_name 你的域名;
location / {
# 指向我们打包后上传的前端文件
root /data/dist;
index index.html;
}
location /platform-admin {
# 转发请求到后端
proxy_pass http://你的域名:8888/platform-admin;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /platform-api {
# 转发请求到后端
proxy_pass http://你的域名:8889/platform-api;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 443 ssl;
server_name 你的域名;
ssl_certificate ../cert/你的域名.pem;
ssl_certificate_key ../cert/你的域名.key;
ssl_session_timeout 5m;
ssl_ciphers 你的加密套件;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #使用该协议进行配置。
ssl_prefer_server_ciphers on;
location /h5 {
# h5移动端页面
alias '/data/h5';
expires 7d;
}
location /platform-api {
# 转发请求到后端
proxy_pass http://你的域名:8889/platform-api;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}