下载drupal,建议手动下载最新,这里直接在服务器下载。8.x,请更换为具体的版本wget https://ftp.drupal.org/files/projects/drupal-8.x.tar.gz
注意:请确认你使用的环境是centos8!
1、安装mysql8或者mariadb10.3,这里用mysql8安装;mariadb10.3的下载和安装方式跟mysql8一样,将mysql换成mariadb即可,默认安装的就是10.3版本。。dnf install mysql mysql-server
配置mysql,根据提示创建数据库密码(你也可以创建数据库的单独用户,这里不再创建单独用户)mysql_secure_installation
重启数据库systemctl restart mysqld
2、安装nginx,默认安装的是nginx1.14版本dnf install nginx
配置nginx.conf,注意:user用户要给nginx权限,这样在安装drupal的时候,不用再费劲的配置每个文件的属性。另外drupal网站目录也应该给予nginx的权限vi /etc/nginx/nginx.conf
写入以下内容到nginx.conf,内容已调优,如果有自己的需求,可以按照自己的需求修订# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
keepalive_timeout 60;
types_hash_max_size 2048;
client_max_body_size 8M;
gzip on;
gzip_vary on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_disable "MSIE [1-6]\.";
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
}
配置drupal.confvi /etc/nginx/conf.d/drupal.conf
写入以下内容到drupal.confserver {
listen 80;
server_name drupal.rednn.cn;
root /srv/drupal; // drupal所在位置
location / {
root /srv/drupal;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php$is_args$args;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
include /etc/nginx/default.d/*.conf; // 在default.d文件夹下有个php.conf配置文件,里面自动写入了环境参数,直接调用即可。
location ~ /\.ht {
deny all;
}
}
nginx配置完毕,重启systemctl restart nginx
3、安装php及所有扩展,默认安装的是php7.2版本dnf install php*
启动phpsystemctl start php-fpm
4、上传drupal网站目录
给予drupal目录nginx权限chown nginx:nginx -R /srv/drupal/
按照提示安装,end!
欢迎指正交流,如果在配置过程中出现问题,可以在下方留言。