搭建Discuz!论坛
1、了解PHP环境的搭建
2、掌握基础Discuz!搭建与安装
3、了解腾讯云服务器的选购注意事项
第一步:购买学习用的腾讯云服务器
地址:https://url.cn/5ZUrU1J
1、选择服务器系统 CentOS 6.9
第二步:配置 Nginx 环境安装
1、使用 yum 安装 nginx :
yum intsall nginx -y
2、启动并验证 Nginx
nginx ---- 启动 nginx 代理服务器,并通过公网IP验证安装
第三步:mysql 环境安装与配置
1、安装 mysql-server
yum install mysql-server -y
2、启动 mysqld
service mysqld restart ----注意:是使用 mysqld 启动
3、设置密码
/usr/bin.mysqladmin -u root password 123456 ‘设置自己的密码’
4、设置开机启动
chkconfig mysqld on
第四步:PHP 环境安装与配置
1、安装 PHP
yum instal php-fpm php-mysql -y
2、启动 php-fpm
service php-fpm start
3、查看进程
netstat -nlpt|grep php-fpm 查看 php-fpm 监听的端口为:9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 7557/php-fpm
4、设置开机启动
chkconfig php-fpm on
第五步:修改 Nginx 的配置文件
1、修改 nginx 配置
vim /etc/nginx/conf.d/default.conf 进入 default.conf 进行修改
--------------原代码---------------
server {
listen 80 default_server;
listen [::]:80 default_server; #注释掉此行
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
-----------修改后的代码 -----------
server {
listen 80 default_server;
#listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
2、查看 /usr/share/nginx/html 路径有什么文件?
cd /usr/share/nginx/html
ls
显示文件如下:
50x.html index.html nginx-logo.png poweredby.png
rm index.html ---- 除掉这个 index.html 文件
第六步:下载Discuz!论坛
1、使用 wget 下载 Discuz!压缩包在/usr/share/nginx/html 目录下
Discuz_X3.4 去官方 查找下载地址:https://www.discuz.net/thread-3847642-1-1.html
2、Discuz_X3.4_SC_UTF8【20191201】上传到 /usr/share/nginx/html 目录下 进行解压。
unzip Discuz_X3.4_SC_UTF8??20191201??.zip
3、把 upload 目录下的所有文件移到 /usr/share/nginx/html 目录下。
mv upload/* ./
4、查看/usr/share/nginx/html 目录下是否移动过来了。
ls
第七步:再次修改 nginx 配置,增加fastcgi 配置项,把 nginx 请求转发给 PHP-FPM 。
1、vim 修改 default.conf 配置文件
vim /etc/nginx/conf.d/default.conf
2、增加fastcgi 配置项,把 nginx 请求转发给 PHP-FPM
-----修改的代码-------
server {
listen 80 default_server;
#listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
index index.php index.html;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
# pass the PHP>
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
3、重启 nginx 服务
nginx -s reload
第八步:安装 Discuz!论坛设置 与 mysql 配置
1、使用服务器公网IP 在浏览中打开Discuz!论坛安装
2、设置Discuz!论坛在服务器路径中的目录权限,把uc_dient 文件的重 命名改为 uc_client (下载到桌面修改),再上传回去进行设置它的权 限。
3、登陆 mysql 数据库设置Discuz!论坛的数据库
mysql -uroot -p ----返回服务器终端输入命令登陆mysql
password:123456 ----输入之前在服务器配置的mysql登陆 密码
CREATE DATABASE wordpress; ---- 创建一个 wordpress
show databases; ---- 查询数据库列表
4、转到浏览器填写数据名 wordpress,root,密码 等相关信息
閱讀更多 卓帥成長史OL 的文章