Todo List:
- 服务器选购
- 域名
- Flarum Composer 安装部署
一、服务器选购
本人选购为腾讯云 轻量应用服务器
可用区:Hongkong Region (免去备案复杂流程)
操作系统: ubuntu 24.04
# 配置参数
cpu: 2 core
memory: 2G
Disk: 40G
二、域名选购(自行购买)
注册链接
完成域名dns解析: 主要是www 和 @ , 我这里使用到了腾讯云的边缘服务EdgeOne ,所以域名解析如下图:
三、具体部署细节
#软件依赖版本
PHP 8.2.24
Composer version 2.8.1
Mysql 8.0.39
Nginx/1.24.0
php8.2 install
sudo add-apt-repository ppa:ondrej/php
sudo apt install php8.2 php8.2-fpm php8.2-dev php8.2-bcmath php8.2-curl php8.2-gd php8.2-gmp php8.2-gnupg php8.2-imagick php8.2-imap php8.2-intl php8.2-mbstring php8.2-soap php8.2-sqlite3 php8.2-zip php8.2-mysqli php8.2-xml php8.2-igbinary php8.2-redis
# 多版本切换
ll /etc/alternatives/php-config
sudo update-alternatives --config php
sudo service php8.2-fpm reload
sudo service php8.2-fpm status
Composer install
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
sudo composer self-update --2
composer --version
Nginx install and Configuration
sudo apt install nginx
Nginx config file
server {
listen 80;
server_name log2x.cn xxx;
return 301 https://server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name xxx;
server_tokens off;
#ssl_dhparam /etc/nginx/ssl/dhparam.pem;
ssl_certificate /etc/nginx/certs/lxxx_bundle.crt;
ssl_certificate_key /etc/nginx/certs/xxx.key;
ssl_session_timeout 1d;
ssl_session_cache shared:MozSSL:10m;
ssl_session_tickets off;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";
root /usr/share/nginx/html/xxx/public;
index index.html index.htm index.php;
client_max_body_size 30M;
include /usr/share/nginx/html/xxx/.nginx.conf;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location /robots.txt {
try_files $uri $uri/ =404;
}
}
Mysql install 参考链接
sudo apt install mysql-server
sudo mysql_secure_installation
# 修改root密码
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_new_password';
FLUSH PRIVILEGES;
# create database
create database xxx_db
Flarum composer install
cd /usr/share/nginx/html/
composer create-project flarum/flarum .
sudo chown -R www-data:www-data xxx
sudo chmod -R 775 xxx
访问你的域名,即可开始安装页面,填写mysql数据库帐号密码,等待安装完成后,你的站点就此安装完成
赞赏