碎碎念 最近又看到了Xboard
,想着干脆迁移一下。某些人又特别喜欢咕咕咕,那根据守恒定律我就咕不了。这里先水个初版本。大部分安装可以参考我之前的安装v2board
教程
现在是最终版
安装 Nginx、MariaDB、Redis、Supervisor、Git 1
apt -y install nginx mariadb-server redis-server supervisor git
PHP https://deb.sury.org
添加存储库 1
2
3
4
5
sudo apt-get -y install lsb-release ca-certificates curl
sudo curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
sudo dpkg -i /tmp/debsuryorg-archive-keyring.deb
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt-get update
安装PHP 这里一定要PHP8.1,问就是踩坑了
1
apt -y install php8.1-common php8.1-redis php8.1-curl php8.1-mysql php8.1-zip php8.1-xml php8.1-swoole
拉取项目源码 1
2
3
cd /var/www;
git clone https://github.com/cedar2025/Xboard.git xboard;
cd xboard
初始化数据库 创建一个名为xboard的数据库和用户 1
2
3
4
create database xboard ;
grant all privileges on xboard . * to xboard @ 'localhost' identified by 'passwd' ;
flush privileges ;
exit ;
安装v2board并配置Nginx 1
2
3
4
一切就绪
管理员邮箱:114514@gmail.com
管理员密码:114514
访问 http( s) ://你的站点/114514 进入管理面板,你可以在用户中心修改你的密码。
配置Nginx 1
nano /etc/nginx/conf.d/xboard.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
server {
listen 80 ;
server_name yourdomain.com ;
root /var/www/xboard/public ;
index index.php ;
client_max_body_size 0 ;
location ~ * \.(jpg|jpeg|png|gif|js|css|svg|woff2|woff|ttf|eot|wasm|json|ico) $ {
}
location ~ .* {
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 ;
}
}
赋予网站权限 1
2
3
chown -R www-data:www-data /var/www/;
find /var/www/ -type d -exec chmod 755 {} \;
find /var/www/ -type f -exec chmod 644 {} \;
迁移 https://github.com/cedar2025/Xboard/tree/dev/docs
数据库 备份v2board数据库 1
mysqldump - u [ user ] - p [ database ] > backup . sql
清空数据库 导入旧数据库(重要)数据库 1
mysql - p - u [ user ] [ database ] < db_backup . dump
执行迁移命令 1
php artisan migratefromv2b dev231027
停止config/v2board.php 配置文件 将旧的 config/v2board.php
文件复制到 xboard的 config/v2board.php
下 执行下面的命令,即可完成迁移 1
php artisan migrateFromV2b config
开启webman 在上述安装的基础上开启webman提高性能
配置php.ini 通过SSH登录到服务器后访问站点路径如:/www/wwwroot/你的站点域名。
1
cp /etc/php/8.1/cli/php.ini /var/www/xboard/cli-php.ini
1
sed -i 's/^disable_functions[[:space:]]*=[[:space:]]*.*/disable_functions=header,header_remove,headers_sent,http_response_code,setcookie,session_create_id,session_id,session_name,session_save_path,session_status,session_start,session_write_close,session_regenerate_id,set_time_limit/g' cli-php.ini
添加守护进程 1
nano /etc/supervisor/conf.d/webman.conf
1
2
3
4
5
6
7
8
[ program :webman ]
command = php - c / var / www / xboard / cli - php . ini / var / www / xboard / webman . php start
numprocs = 1
user = www - data
autostart = true
autorestart = true
redirect_stderr = true
stdout_logfile =/ var / www / xboard / storage / logs / webman . log
1
supervisorctl status webman
守护进程 1
nano /etc/supervisor/conf.d/xboard.conf
1
2
3
4
5
6
7
8
[ program :xboard ]
command = php / var / www / xboard / artisan horizon
numprocs = 1
user = www - data
autostart = true
autorestart = true
redirect_stderr = true
stdout_logfile =/ var / www / xboard / storage / logs / queue . log
启动Xboard的队列任务 查看队列任务状态 1
supervisorctl status xboard
添加计划任务 1
* * * * * php / var / www / xboard / artisan schedule : run
Licensed under CC BY-NC-SA 4.0