CentOS7上使用yum部署Discuz!Q
文档资料
官方指引
官方站点: https://discuz.com/
示例站点:https://discuz.chat/
安装指引: https://discuz.com/docs/Linux%20%E4%B8%BB%E6%9C%BA.html#nginx
社区使用
后台登录:管理中心首页 (fxiaoke.com)
程序部署
系统准备
#!/bin/bash
yum makecache
yum update -y
# 创建本地软件源
# 因为是在内网环境部署,所以采用yumdownload下载软件后,使用本机源的形式部署。
# 使用remi和epel源
tar zxvf php74.tar.gz -C /opt/
yum install -y createrepo
createrepo /opt/php74/
yum-config-manager --add-repo file:/opt/php74
# 安装软件包打包证书
# wget https://rpms.remirepo.net/RPM-GPG-KEY-remi
#导入证书
rpm --import RPM-GPG-KEY-remi
# 安装nginx和PHP
yum install -y nginx
yum install -y php php-cli php-fpm php-gd php-mysqlnd php-odbc php-bcmath php-curl php-fileinfo php-nette-tokenizer php-xmlrpc php-date php-soap php-ldap php-mbstring libmcrypt libmcrypt-devel php-pecl-apcu mhash php-dom php-xmlreader php-date php-exif php-filter php-hash php-iconv php-json php-libxml php-mysqlnd php-openssl php-pcre php-posix hp-tokenizer php-zlib php-opcache php-zip
# 拉起服务
systemctl daemon-reload
systemctl enable --now nginx php-fpm
# 开放80端口
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
#论坛程序部署
mkdir -p /wwwroot/discuz/public
unzip dzq_latest_install.zip -d /wwwroot/discuz/
chown -R nginx:nginx /wwwroot/
# 配置PHP-fpm
sed -i 's\;exif.\exif.\g' /etc/php.ini
sed -i 's@date.timezone =@date.timezone = Asia\Shanghai@g' /etc/php.ini
sed -i 's\zlib.output_compression = Off\zlib.output_compression = On\g' /etc/php.ini
sed -i 's\user = apache\ user = nginx\g' /etc/php-fpm.d/www.conf
sed -i 's\group = apache\ group = nginx\g' /etc/php-fpm.d/www.conf
systemctl restart php-fpm.service
netstat -tlnp
配置Nginx
server {
listen 80;
listen [::]:80;
server_name forum.fxiaoke.com;
# 修改root目录
root /wwwroot/discuz/public/;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
# 添加配置参数
index index.php;
gzip on;
gzip_min_length 1024;
gzip_types application/json text/css application/x-javascript application/javascript application/vnd.api+json;
gzip_disable "MSIE [1-6]\.";
gzip_comp_level 2;
# 配置rewrite模块
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# 添加PHP支持
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include fastcgi_params;
}
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.