2025-01-06 23:41:52 -05:00
|
|
|
|
## aaPanel 快速部署指南
|
2024-04-20 08:27:45 -04:00
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
本指南介绍如何使用 aaPanel 部署 Xboard。
|
2023-11-22 01:01:58 -05:00
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
⚠️ 不建议在 CentOS 7 上部署,可能会遇到兼容性问题。
|
2023-11-22 01:01:58 -05:00
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
### 1. 环境准备
|
|
|
|
|
|
|
|
|
|
安装 aaPanel:
|
|
|
|
|
```bash
|
|
|
|
|
URL=https://www.aapanel.com/script/install_6.0_en.sh && \
|
|
|
|
|
if [ -f /usr/bin/curl ];then curl -ksSO "$URL" ;else wget --no-check-certificate -O install_6.0_en.sh "$URL";fi && \
|
|
|
|
|
bash install_6.0_en.sh aapanel
|
2023-11-22 01:01:58 -05:00
|
|
|
|
```
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
|
|
|
|
### 2. 环境配置
|
|
|
|
|
|
|
|
|
|
1. 在 aaPanel 中安装 LNMP:
|
|
|
|
|
- Nginx(任意版本)
|
|
|
|
|
- MySQL 5.7
|
2025-01-10 00:14:53 -05:00
|
|
|
|
- PHP 8.2
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
|
|
|
|
2. 安装 PHP 扩展:
|
|
|
|
|
- redis
|
|
|
|
|
- fileinfo
|
|
|
|
|
- swoole4
|
|
|
|
|
- readline
|
|
|
|
|
- event
|
|
|
|
|
|
|
|
|
|
3. 解除 PHP 禁用函数:
|
|
|
|
|
- putenv
|
|
|
|
|
- proc_open
|
|
|
|
|
- pcntl_alarm
|
|
|
|
|
- pcntl_signal
|
|
|
|
|
|
|
|
|
|
### 3. 部署步骤
|
|
|
|
|
|
|
|
|
|
1. 添加站点:
|
|
|
|
|
- 进入 aaPanel > Website > Add site
|
|
|
|
|
- 填写域名
|
|
|
|
|
- 数据库选择 MySQL
|
|
|
|
|
- PHP 版本选择 8.1
|
|
|
|
|
|
|
|
|
|
2. 安装 Xboard:
|
|
|
|
|
```bash
|
|
|
|
|
# 进入站点目录
|
|
|
|
|
cd /www/wwwroot/你的域名
|
|
|
|
|
|
|
|
|
|
# 清理目录
|
2023-11-22 01:01:58 -05:00
|
|
|
|
chattr -i .user.ini
|
2024-06-02 01:56:57 -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 ./
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
|
|
|
|
# 安装依赖
|
2023-11-22 01:01:58 -05:00
|
|
|
|
sh init.sh
|
|
|
|
|
```
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
|
|
|
|
3. 配置站点:
|
|
|
|
|
- 设置运行目录为 `/public`
|
|
|
|
|
- 配置伪静态规则:
|
|
|
|
|
```nginx
|
2023-11-22 01:01:58 -05:00
|
|
|
|
location /downloads {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
location / {
|
|
|
|
|
try_files $uri $uri/ /index.php$is_args$query_string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
location ~ .*\.(js|css)?$
|
|
|
|
|
{
|
|
|
|
|
expires 1h;
|
|
|
|
|
error_log off;
|
|
|
|
|
access_log /dev/null;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
4. 配置守护进程:
|
|
|
|
|
- 安装 Supervisor
|
|
|
|
|
- 添加队列守护进程:
|
|
|
|
|
- 名称:`Xboard`
|
|
|
|
|
- 运行用户:`www`
|
|
|
|
|
- 运行目录:站点目录
|
|
|
|
|
- 启动命令:`php artisan horizon`
|
|
|
|
|
- 进程数:1
|
2023-11-22 01:01:58 -05:00
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
5. 添加计划任务:
|
|
|
|
|
- 类型:Shell Script
|
|
|
|
|
- 任务名:v2board
|
|
|
|
|
- 周期:1分钟
|
|
|
|
|
- 脚本内容:`php /www/wwwroot/站点目录/artisan schedule:run`
|
2023-11-22 01:01:58 -05:00
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
### 4. 开启 Octane(可选)
|
2025-01-07 06:00:14 -05:00
|
|
|
|
1. 添加 Octane 守护进程:
|
2025-01-06 23:41:52 -05:00
|
|
|
|
- 名称:Octane
|
|
|
|
|
- 运行用户:www
|
|
|
|
|
- 运行目录:站点目录
|
|
|
|
|
- 启动命令:`/www/server/php/81/bin/php artisan octane:start --port 7010`
|
|
|
|
|
- 进程数:1
|
2023-11-22 22:12:33 -05:00
|
|
|
|
|
2025-01-07 06:00:14 -05:00
|
|
|
|
2. 更新伪静态规则:
|
2025-01-06 23:41:52 -05:00
|
|
|
|
```nginx
|
|
|
|
|
location ~* \.(jpg|jpeg|png|gif|js|css|svg|woff2|woff|ttf|eot|wasm|json|ico)$ {
|
2023-11-22 01:01:58 -05:00
|
|
|
|
}
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
2023-11-22 22:12:33 -05:00
|
|
|
|
location ~ .* {
|
2025-01-06 23:41:52 -05:00
|
|
|
|
proxy_pass http://127.0.0.1:7010;
|
|
|
|
|
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;
|
|
|
|
|
}
|
2023-11-22 01:01:58 -05:00
|
|
|
|
```
|
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
### 5. 版本更新
|
2023-11-22 01:01:58 -05:00
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
```bash
|
|
|
|
|
# 更新代码
|
|
|
|
|
cd /www/wwwroot/你的域名
|
2023-11-22 01:01:58 -05:00
|
|
|
|
sh update.sh
|
2025-01-06 23:41:52 -05:00
|
|
|
|
|
|
|
|
|
# 如果启用了 Octane,需要重启守护进程
|
|
|
|
|
# aaPanel > App Store > Tools > Supervisor > 重启 Octane
|
2023-11-22 01:01:58 -05:00
|
|
|
|
```
|
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
### 注意事项
|
2023-11-22 01:01:58 -05:00
|
|
|
|
|
2025-01-06 23:41:52 -05:00
|
|
|
|
- 修改后台路径需要重启服务才能生效
|
|
|
|
|
- 启用 octane 后的任何代码修改都需要重启才能生效
|