Files
AIGC/demo/deploy_baota
2025-11-13 17:01:39 +08:00
..
2025-11-13 17:01:39 +08:00
2025-11-13 17:01:39 +08:00
2025-11-13 17:01:39 +08:00
2025-11-13 17:01:39 +08:00

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 宝塔面板部署说明

## 文件结构
- backend/ - 后端部署文件
  - app.jar - Spring Boot应用JAR包
  - start.sh - 启动脚本
  - application-prod.properties.template - 配置文件模板
- frontend/ - 前端部署文件
  - dist/ - 前端构建产物
  - nginx.conf - Nginx配置示例

## 部署步骤

### 1. 数据库部署
1. 解压 database_baota_*.zip
2. 登录宝塔面板 -> 数据库 -> phpMyAdmin
3. 创建数据库aigc_platform
4. 导入 init_database.sql

### 2. 后端部署
1. 上传 backend/ 目录到服务器(如:/www/wwwroot/aigc-backend
2. 修改配置文件:
   - 复制 application-prod.properties.template 为 application-prod.properties
   - 修改数据库连接信息默认172.22.0.2:3306
   - 修改JWT密钥、AI API密钥等
   - 注意:数据库地址已配置为 172.22.0.2,请根据实际环境调整
3. 安装Java 21如未安装
   - 宝塔面板 -> 软件商店 -> 安装 Java项目管理器
   - 或手动安装yum install java-21-openjdk
4. 设置启动脚本权限:
   chmod +x /www/wwwroot/aigc-backend/start.sh
5. 启动后端:
   cd /www/wwwroot/aigc-backend
   ./start.sh start
6. 检查日志:
   tail -f logs/app.log

### 3. 前端部署
1. 上传 frontend/dist/ 目录内容到网站根目录(如:/www/wwwroot/your-domain.com
2. 配置Nginx
   - 宝塔面板 -> 网站 -> 选择网站 -> 设置 -> 配置文件
   - 参考 frontend/nginx.conf 配置反向代理
   - 修改 server_name 为实际域名
   - 修改 root 为实际网站目录
   - 注意:后端代理地址已配置为 172.22.0.1:8080请根据实际环境调整
3. 重启Nginx
   systemctl restart nginx

### 4. 防火墙设置
- 开放端口80HTTP、443HTTPS、8080后端如需要外网访问
- 宝塔面板 -> 安全 -> 添加端口规则

### 5. SSL证书推荐
- 宝塔面板 -> 网站 -> SSL -> Let's Encrypt免费证书

## 常用命令

### 后端管理
- 启动:./start.sh start
- 停止:./start.sh stop
- 重启:./start.sh restart
- 状态:./start.sh status
- 查看日志tail -f logs/app.log

### 前端管理
- 重启Nginxsystemctl restart nginx
- 查看Nginx日志tail -f /www/wwwroot/logs/your-domain.com.log

## 注意事项
1. 确保Java版本为21
2. 确保MySQL版本为8.0+
3. 确保服务器内存至少4GB推荐8GB
4. 配置文件中的敏感信息请妥善保管
5. 定期备份数据库和上传文件