2025-01-15 21:47:26 -05:00
|
|
|
|
# Xboard 在 aaPanel + Docker 环境下的部署指南
|
|
|
|
|
|
|
|
|
|
## 目录
|
|
|
|
|
1. [环境要求](#环境要求)
|
|
|
|
|
2. [快速部署](#快速部署)
|
|
|
|
|
3. [详细配置](#详细配置)
|
|
|
|
|
4. [维护指南](#维护指南)
|
|
|
|
|
5. [故障排查](#故障排查)
|
|
|
|
|
|
|
|
|
|
## 环境要求
|
|
|
|
|
|
|
|
|
|
### 硬件配置
|
|
|
|
|
- CPU: 1核心及以上
|
|
|
|
|
- 内存: 2GB及以上
|
|
|
|
|
- 硬盘: 10GB及以上可用空间
|
|
|
|
|
|
|
|
|
|
### 软件要求
|
|
|
|
|
- 操作系统: Ubuntu 20.04+ / CentOS 7+ / Debian 10+
|
|
|
|
|
- aaPanel 最新版
|
|
|
|
|
- Docker 和 Docker Compose
|
|
|
|
|
- Nginx(任意版本)
|
|
|
|
|
- MySQL 5.7+
|
2023-11-22 01:01:58 -05:00
|
|
|
|
|
2025-01-15 21:47:26 -05:00
|
|
|
|
## 快速部署
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
2025-01-15 21:47:26 -05:00
|
|
|
|
### 1. 安装 aaPanel
|
|
|
|
|
```bash
|
|
|
|
|
curl -sSL https://www.aapanel.com/script/install_6.0_en.sh -o install_6.0_en.sh && \
|
|
|
|
|
bash install_6.0_en.sh aapanel
|
|
|
|
|
```
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
2025-01-15 21:47:26 -05:00
|
|
|
|
### 2. 基础环境配置
|
|
|
|
|
|
|
|
|
|
#### 2.1 安装 Docker
|
2025-01-06 23:41:52 -05:00
|
|
|
|
```bash
|
|
|
|
|
# 安装 Docker
|
2024-03-20 06:47:28 -04:00
|
|
|
|
curl -sSL https://get.docker.com | bash
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
|
|
|
|
# CentOS 系统需要执行:
|
2024-03-20 06:47:28 -04:00
|
|
|
|
systemctl enable docker
|
|
|
|
|
systemctl start docker
|
|
|
|
|
```
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
2025-01-15 21:47:26 -05:00
|
|
|
|
#### 2.2 安装必要组件
|
|
|
|
|
在 aaPanel 面板中安装:
|
2025-01-06 23:41:52 -05:00
|
|
|
|
- Nginx(任意版本)
|
|
|
|
|
- MySQL 5.7
|
|
|
|
|
- ⚠️ 无需安装 PHP 和 Redis
|
2023-11-22 01:01:58 -05:00
|
|
|
|
|
2025-01-15 21:47:26 -05:00
|
|
|
|
### 3. 站点配置
|
2023-11-22 01:01:58 -05:00
|
|
|
|
|
2025-01-15 21:47:26 -05:00
|
|
|
|
#### 3.1 创建站点
|
|
|
|
|
1. 导航至:aaPanel > Website > Add site
|
|
|
|
|
2. 填写信息:
|
|
|
|
|
- 域名:填写您的站点域名
|
2025-01-06 23:41:52 -05:00
|
|
|
|
- 数据库:选择 MySQL
|
|
|
|
|
- PHP 版本:选择纯静态
|
|
|
|
|
|
2025-01-15 21:47:26 -05:00
|
|
|
|
#### 3.2 部署 Xboard
|
2025-01-06 23:41:52 -05:00
|
|
|
|
```bash
|
|
|
|
|
# 进入站点目录
|
|
|
|
|
cd /www/wwwroot/你的域名
|
|
|
|
|
|
|
|
|
|
# 清理目录
|
2023-11-22 01:01:58 -05:00
|
|
|
|
chattr -i .user.ini
|
2024-07-15 14:25:49 -04:00
|
|
|
|
rm -rf .htaccess 404.html 502.html index.html .user.ini
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
|
|
|
|
# 克隆代码
|
2025-01-15 11:55:00 -05:00
|
|
|
|
git clone https://github.com/cedar2025/Xboard.git ./
|
2023-11-22 01:01:58 -05:00
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
# 准备配置文件
|
|
|
|
|
cp compose.sample.yaml compose.yaml
|
|
|
|
|
|
|
|
|
|
# 安装依赖并初始化
|
|
|
|
|
docker compose run -it --rm web sh init.sh
|
2023-11-22 01:01:58 -05:00
|
|
|
|
```
|
2025-01-15 21:47:26 -05:00
|
|
|
|
> ⚠️ 请妥善保存安装完成后返回的后台地址和管理员账号密码
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
2025-01-15 21:47:26 -05:00
|
|
|
|
#### 3.3 启动服务
|
2025-01-06 23:41:52 -05:00
|
|
|
|
```bash
|
2023-11-22 01:01:58 -05:00
|
|
|
|
docker compose up -d
|
|
|
|
|
```
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
2025-01-15 21:47:26 -05:00
|
|
|
|
#### 3.4 配置反向代理
|
|
|
|
|
在站点配置中添加以下内容:
|
2025-01-06 23:41:52 -05:00
|
|
|
|
```nginx
|
2025-01-15 21:47:26 -05:00
|
|
|
|
location / {
|
2023-12-08 07:33:10 -05:00
|
|
|
|
proxy_pass http://127.0.0.1:7001;
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Connection "";
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Real-PORT $remote_port;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
|
proxy_set_header Scheme $scheme;
|
|
|
|
|
proxy_set_header Server-Protocol $server_protocol;
|
|
|
|
|
proxy_set_header Server-Name $server_name;
|
|
|
|
|
proxy_set_header Server-Addr $server_addr;
|
|
|
|
|
proxy_set_header Server-Port $server_port;
|
2024-03-20 06:47:28 -04:00
|
|
|
|
proxy_cache off;
|
2023-12-08 07:33:10 -05:00
|
|
|
|
}
|
|
|
|
|
```
|
2023-11-22 01:01:58 -05:00
|
|
|
|
|
2025-01-15 21:47:26 -05:00
|
|
|
|
## 维护指南
|
|
|
|
|
|
|
|
|
|
### 版本更新
|
2023-11-22 01:01:58 -05:00
|
|
|
|
|
2025-01-15 21:47:26 -05:00
|
|
|
|
> 💡 重要提示:根据您安装的版本不同,更新命令可能略有差异:
|
|
|
|
|
> - 如果您是最近安装的新版本,使用下面的命令:
|
2025-01-06 23:41:52 -05:00
|
|
|
|
```bash
|
2025-01-15 21:47:26 -05:00
|
|
|
|
docker compose pull && \
|
|
|
|
|
docker compose run -it --rm web php artisan xboard:update && \
|
|
|
|
|
docker compose up -d
|
|
|
|
|
```
|
|
|
|
|
> - 如果您是较早安装的旧版本,需要将命令中的 `web` 改为 `xboard`,即:
|
|
|
|
|
```bash
|
|
|
|
|
docker compose pull && \
|
|
|
|
|
docker compose run -it --rm xboard php artisan xboard:update && \
|
|
|
|
|
docker compose up -d
|
2023-11-22 01:01:58 -05:00
|
|
|
|
```
|
2025-01-15 21:47:26 -05:00
|
|
|
|
> 🤔 不确定用哪个?可以先尝试使用新版命令,如果报错再使用旧版命令。
|
2023-11-25 22:56:44 -05:00
|
|
|
|
|
2025-01-15 21:47:26 -05:00
|
|
|
|
### 日常维护
|
|
|
|
|
- 定期检查日志: `docker compose logs`
|
|
|
|
|
- 监控系统资源使用情况
|
|
|
|
|
- 定期备份数据库和配置文件
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
2025-01-15 21:47:26 -05:00
|
|
|
|
## 故障排查
|