基於lnmp環境安裝Discuz

安裝環境

Linux:CentOS Linux release 7.5.1804 (Core)
nginx:1.14.2
php-fpm:5.4.16
mariadb-server:5.5.60
基本以上信息安裝lnmp環境php

安裝nginx的yum源

rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

安裝相關軟件包

yum -y install vim lrzsz nginx php-fpm mariadb-server php-mysql

關閉SELinux

setenforce 0

防火牆開啓相關端口

firewall-cmd --zone=public --add-service=http
firewall-cmd --zone=public --add-port=9000/tcp
firewall-cmd --zone=public --add-service=mysql

啓動數據庫、建立帳號

systemctl start mariadb
mysql -e "grant all privileges on *.* to user1@'%' identified by '123456';"
mysql -e "flush privileges;"

建立虛擬主機文件

在/etc/nginx/conf.d/下建立.conf結尾的虛擬主機配置文件 :html

server {
    listen       80;
    server_name  www.a.com;
    location / {
        root   /usr/share/nginx/html;
        index  index.php index.html index.htm;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    #
    location ~ \.php$ {
        root           /usr/share/nginx/html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

}

刪除原有default配置文件
檢測nginx配置文件語法:mysql

nginx -t

啓動相關服務

systemctl start php-fpm 
systemctl restart nginx

安裝Discuz

上傳Discuz_X3.3_SC_UTF8.zip 到服務器,解壓,複製upload目錄下所有文件到/usr/share/nginx/html/下
設置facl權限linux

setfacl -R -m u:nginx:rwx ./*
setfacl -R -m u:apache:rwx ./*

重啓nginx服務,web登陸,初始化相關數據。nginx

回收facl權限

setfacl -b ./*
相關文章
相關標籤/搜索