搭建Drupal-8.5.3

 

环境说明

系统版本    CentOS 6.9 x86_64

软件版本    yum安装nginx 1.10.2

            yum安装php 7.2.6(当前的最新版本)

            yum安装mysql 5.5.60

            drupal-8.5.3(当前的最新版本)

Drupal是使用PHP语言编写的开源内容管理框架(CMF),它由内容管理系统(CMS)和PHP开发框架(Framework)共同构成。连续多年荣获全球最佳CMS大奖,是基于PHP语言最著名的WEB应用程序。截止2011年底,共有13,802位WEB专家参加了Drupal的开发工作;228个国家使用181种语言的729,791位网站设计工作者使用Drupal。著名案例包括:联合国、美国白宫、美国商务部、纽约时报、华纳、迪斯尼、联邦快递、索尼、美国哈佛大学、Ubuntu等。(来自百度百科)

官网网站:https://www.drupal.org/

中国官网:http://drupalchina.cn/

1、添加启用php第三方的remi源

1.1 安装remi源

remi源需要先安装epel源,再安装remi源

yum install -y epel-release

rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-6.rpm

1.2 启用所需要的remi源中php版本源

vim /etc/yum.repo.d/remi.repo

vim /etc/yum.repos.d/remi-php72.repo

2、安装nginx和php

yum install nginx -y        #安装nginx

yum install php-fpm php-cli -y    #安装php-fpmphp-cliphp-cliphp的相关命令

3、配置nginx支持php

grep -Ev '^$|#' /etc/nginx/nginx.conf.default >/etc/nginx/nginx.conf

vim /etc/nginx/nginx.conf

worker_processes 1;

events {

worker_connections 1024;

}

http {

include mime.types;

default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;

server {

listen 80;

server_name localhost;

index index.php index.html index.htm;

location / {

root html;

}

location ~ \.php$ {

root html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

}

}

检验

[root@localhost ~]# cd /usr/share/nginx/html/

[root@localhost html]# ls

404.html 50x.html index.html nginx-logo.png poweredby.png

[root@localhost html]# rm -rf *

[root@localhost html]# vim index.php

<?php

phpinfo();

?>

启动nginxphp

[root@localhost html]# nginx

[root@localhost html]# /etc/init.d/php-fpm start

Starting php-fpm: [ OK ]

修改php用户

vim /etc/php-fpm.d/www.conf

24 user = nginx

25 ; RPM: Keep a group allowed to write in log dir.

26 group = nginx

/etc/init.d/php-fpm restart        #重新启动php

4、安装配置mysql

yum install mysql-server -y    #安装mysql

/etc/init.d/mysqld start        #启动数据库

mysql    #登录进入数据库创库授权

mysql> create database drupal;

Query OK, 1 row affected (0.00 sec)

mysql> grant all on drupal.* to drupal@'localhost' identified by '123456';

Query OK, 0 rows affected (0.00 sec)

5、安装drupal

[root@localhost ~]# cd /usr/share/nginx/html/

[root@localhost html]# wget -c http://ftp.drupal.org/files/projects/drupal-8.5.3.tar.gz

[root@localhost html]# tar xf drupal-8.5.3.tar.gz

[root@localhost html]# mv drupal-8.5.3/* .

[root@localhost html]# chown -R nginx.nginx .        #修改用户和用户组

   

Web界面安装

解决错误

yum install php-dom php-gd php-pdo php-xml -y

解决警告

yum install php-opcache -y

重启php

/etc/init.d/php-fpm restart

数据库类型没有mysql

yum install php-mysql -y

重启php

/etc/init.d/php-fpm restart

输入数据库信息进行下一步

等待安装完成,输入站点信息设置网站,完成安装

6、配置nginx_rewrite规则

Drupal默认在网站中已经配置好了伪静态,如果不进行nginx的配置,点击其他页面会出现404

vim /etc/nginx/nginx.conf

location / {

try_files $uri $uri/ /index.php;

}

重启nginx

7、网站进一步优化

点击进入官网的解决方案

为网站设置域名,重启nginx

server_name www.drupal.com

本地添加host解析

[root@localhost html]# vim sites/default/settings.php

加在最后

$settings['trusted_host_patterns'] = [

'^www\.test\.com$',

];

刷新,错误已解决

yum install php-pecl-uploadprogress -y        #安装上传进度条模块

/etc/init.d/php-fpm restart    #重启php

至此,Drupal8.5.3安装完成

博主原创文章,转载请务必注明出处

猜你喜欢

转载自www.cnblogs.com/ssgeek/p/9223453.html