注意:这里用的是Rocky Linux自带的Nginx
1.1 环境准备
1.1.1 安装部署Nginx、MySQL和PHP相关组件
[root@Rocky8-node1 ~]# yum install nginx php-mysqlnd php php-gd php-fpm php-xml mysql-server -y
1.1.2 启动服务
[root@Rocky8-node1 ~]# systemctl enable nginx php-fpm mysqld --now
1.1.3 创建PHP函数
[root@Rocky8-node1 ~]# vim /usr/share/nginx/html/phpinfo.php
<?php
phpinfo();
?>
1.1.4 修改配置文件相关参数
[root@Rocky8-node1 ~]# sed -i '/^user =/ c \user = nginx' /etc/php-fpm.d/www.conf #将用户改为nginx
[root@Rocky8-node1 ~]# sed -i '/^group =/ c \group = nginx' /etc/php-fpm.d/www.conf #将组改为nginx
[root@Rocky8-node1 ~]# sed -i '41 s/_;/localhost;/' /etc/nginx/nginx.conf
[root@Rocky8-node1 ~]# sed -i '43i\index index.php index.html;' /etc/nginx/nginx.conf
[root@Rocky8-node1 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@Rocky8-node1 ~]# systemctl restart nginx php-fpm
1.1.5 创建数据库
[root@Rocky8-node1 ~]# mysql -e 'create database db1 character set utf8;'
[root@Rocky8-node1 ~]# mysql -e "create user fox@localhost identified by '1234'"
[root@Rocky8-node1 ~]# mysql -e 'grant all on *.* to fox@localhost;'
1.1.6 下载网站资源包
[root@Rocky8-node1 ~]# ll Discuz_X3.5_SC_UTF8_20231221.zip
-rw-rw-rw- 1 root root 11593050 Jan 25 18:25 Discuz_X3.5_SC_UTF8_20231221.zip
[root@Rocky8-node1 ~]# unzip Discuz_X3.5_SC_UTF8_20231221.zip
[root@Rocky8-node1 ~]# rm -f /usr/share/nginx/html/index.html #删除默认页面
[root@Rocky8-node1 ~]# mv upload/* /usr/share/nginx/html/ #把upload下的所有内容移动到/usr/share/nginx/html/
1.1.7 nginx用户授权
[root@Rocky8-node1 ~]# cd /usr/share/nginx/html/
[root@Rocky8-node1 html]# setfacl -R -m u:nginx:rwx ./data/ ./uc_server/ ./uc_client/ ./config/
1.2 访问部署论坛
访问 http://192.168.110.31/install/
然后一步步部署即可