CentOS 7.0 快速安装Discuz X3.2
Posted edukong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 7.0 快速安装Discuz X3.2相关的知识,希望对你有一定的参考价值。
一、安装软件:
1、系统更新
yum update #更新Centos7.0系统
reboot #重启Centos7.0系统
2、安装软件 #centos7.0 yum install mariadb-server(mysql-server 的社区版)
二、配置软件
1、配置nginx #vim(Linux文本编辑器),Insert(编辑),Esc>>(退出编辑), Shift+; >> :wq 保存,:q!不保存。
vim /etc/nginx/conf.d/discuz.conf #在conf.d文件夹,新建discuz.conf网站配置文件,代码如下:
#The default server ;
server {
listen 80;
server_name www.020ppw.com;
root /usr/share/nginx/discuz;
location / {
index index.php index.html index.html;
}
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;
}
include /etc/nginx/rewrite.d/*.conf; # 添加Nginx Discuz X3.2 的伪静态rewrite规则
}
mkdir /etc/nginx/rewrite.d # 新建rewrite.d文件夹
vim /etc/nginx/rewrite.d/discuz_x3.2.conf # 新建文件,添加Nginx Discuz X3.2 伪静态rewrite规则:
rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last; rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last; rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last; rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last; rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last; rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last; rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last; rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last; rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last; if (!-e $request_filename) { return 404; }
2、配置php-fpm
vi /etc/php-fpm.d/www.conf
user = nginx
group = nginx
3、创建php的session目录及设置权限
mkdir /var/lib/php/session
chown root.nginx /var/lib/php/session
4、配置mysql
systemctl start mariadb
1)mysqladmin -u root password "XiVUQWuB7cHTg3xU" #设置初始root账户密码为"XiVUQWuB7cHTg3xU"
2)mysqladmin -u root -p password "XiVUQWuB7cHTg3xU" #重新设置root账户密码为"XiVUQWuB7cHTg3xU"。
Enter password: #输入旧的密码,完成新密码的设置。
5、防火墙中打开http服务
systemctl start firewalld
firewall-cmd --permanent --zone=public --add-service=http
systemctl reload firewalld
6、开启服务并重启系统
systemctl enable nginx
systemctl enable php-fpm
systemctl enable mariadb
systemctl enable memcached
systemctl start nginx
systemctl start php-fpm
systemctl start mariadb
systemctl start memcached
三、安装Discuz X3.2
cd /usr/share/nginx/
wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip
unzip Discuz_X3.2_SC_UTF8.zip
mv upload discuz #重命名 Discuz_X3.2_SC_UTF8 的站点目录
chown -R nginx.nginx /usr/share/nginx/discuz #设置目录所有者 nginx.nginx
http://www.020ppw.com/install/index.php #安装Discuz_X3.2_SC_UTF8
vim discuz/config/config_global.php #开启Discuz X3.2 的 memcache 内存优化
$_config[‘memory‘][‘memcache‘][‘server‘] = ‘localhost‘;
http://www.signalr.cn/ #访问你的Discuz网站
四、更新系统
yum -y update #系统更新
reboot #重启系统
-------------------------------------------------------------------------------------------------------
以下是选修内容:
一、安装phpMyAdmin
1、yum install phpMyAdmin
2、添加phpMyAdmin站点(phpMyAdmin.conf):
cd /etc/nginx/conf.d/
vim phpMyAdmin.conf #多站点(.conf),指定listen,server_name,root 的值,请参考nginx.conf.default示例。
#The phpMyAdmin server ;
server {
listen 81;
server_name www.020ppw.com;
root /usr/share/phpMyAdmin;
location / {
index index.php index.html index.html;
}
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;
}
}
chown nginx.nginx /var/lib/php/session #修改文件夹权限root.nginx,默认为root.apache
systemctl restart php-fpm
systemctl restart nginx
#访问phpMyAdmin
----------------------------------------------------------------------------------------------------------------------------------------
CentOS 7.0 镜像发布!
原文:http://bbs.qcloud.com/thread-7903-1-1.html
以上是关于CentOS 7.0 快速安装Discuz X3.2的主要内容,如果未能解决你的问题,请参考以下文章