搭建Discuz论坛的前提条件:
- LNMP环境
- Discuz压缩包
一、检查各服务是否已经启动并且进程正常
- 检查Nginx服务的进程是否已启动和是否有监听80端口:
[root@localhost ~]# ps aux |grep nginx root 10168 0.0 0.2 46032 2036 ? Ss 16:26 0:00 nginx: master process ./sbin/nginx nobody 10768 0.0 0.2 48560 2572 ? S 16:36 0:00 nginx: worker process root 15983 0.0 0.0 112708 984 pts/2 R+ 17:08 0:00 grep --color=auto nginx
- 检查防火墙和SElinux
[root@localhost ~]# systemctl status firewalld.service [root@localhost ~]# getenforce Permissive
- 检查php-fpm服务的进程是否已启动:
[root@localhost ~]# ps aux | grep php-fpm root 11387 0.0 0.8 230312 8728 ? Ss 16:41 0:00 php-fpm: master process (/etc/php-fpm.conf) apache 11388 0.0 0.5 232396 5388 ? S 16:41 0:00 php-fpm: pool www apache 11389 0.0 0.5 232396 5388 ? S 16:41 0:00 php-fpm: pool www apache 11390 0.0 0.6 232532 6008 ? S 16:41 0:00 php-fpm: pool www apache 11391 0.0 0.5 232396 5832 ? S 16:41 0:00 php-fpm: pool www apache 11392 0.0 0.5 232396 5380 ? S 16:41 0:00 php-fpm: pool www root 16025 0.0 0.0 112708 984 pts/2 R+ 17:10 0:00 grep --color=auto php-fpm
- 检查Nginx是否能正常解析php
首先找到你Nginx的默认站点目录,我这里是我这里Nginx的默认站点目录是/data/nginx/html/,你然后将Nginx的默认访问页面文件改为index.php:
接着使用浏览器访问,显示了php的配置信息页面代表能够正常解析。[root@localhost ~]# cd /data/nginx/html/ [root@localhost html]# vim index.php <?php phpinfo(); ?>
- 检查mysql能否正常登陆和使用:
[root@localhost html]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>
二、Discuz下载与安装
-
下载Discuz的压缩包
[root@localhost ~]# mkdir /data [root@localhost ~]# cd /data [root@localhost data]# wget http://ahdx.down.chinaz.com/201712/Discuz_X3.4_SC_UTF8_0101.zip [root@localhost data]# unzip Discuz_X3.4_SC_UTF8_0101.zip [root@localhost data]# cd dir_SC_UTF8/ [root@localhost dir_SC_UTF8]# ls readme upload utility
-
开始配置Discuz
首先将Nginx之前的默认页文件给删掉,然后将以上解压的upload目录下所有的文件拷贝到Nginx默认站点的根目录下:[root@localhost dir_SC_UTF8]# rm -rf /data/nginx/html/index.php [root@localhost dir_SC_UTF8]# cp -r upload/* /data/nginx/html/
接着使用浏览器访问Discuz的配置页面:http://192.168.192.137/install (IP是你机器的IP),访问成功后会显示如下页面,点击同意进入下一步:
然后就会进入目录、文件的权限检查界面
发现里面有很多错误,于是修改权限[root@localhost dir_SC_UTF8]# chmod -R a+w /data
现在里面就没有错误了
没问题后就点击页面下方的”下一步“:
1、选择“全新安装 Discuz! X (含 UCenter Server)”如果你之前没有安装过Discuz就选择此项。
2、选择“仅安装 Discuz! X (手工指定已经安装的 UCenter Server )”
如果你之前安装过Discuz,现在只是升级的话,选择此项并保证之前的 UCenter 是 UCenter 1.6.0 版本,如果之前安装的 UCenter Server 没有进行升级操作的话,一般为 1.5.1 或 1.5.2 版本,你需要首先升级 Ucenter 到 1.6.0版本, 否则安装程序会提示错误,无法继续。因为我是没安装过的所以这里以全新安装 Discuz为例。
点击“下一步”,进入安装数据库的界面,如下图所示:
这里只需要输入你数据库root用户的密码,然后再设置一个admin密码就可以了,发送告警邮件的邮箱写不写都可以,剩下的会自动进行安装:
搞定,完成
-
发帖
然后登录发帖
写入内容,发表帖子
发帖成功,完成