Drupal部署"/>
Drupal部署
下载
Download Drupal | Drupal
解压到:xxx/drupal-9.2.9/
配置nginx
location的配置关系到安装的结果是否正确(不正确的情况,页面上的链接路径会多出/index.php/)
server {listen 8080;server_name _; root xxx/drupal-9.2.9;index index.html index.htm index.php; rewrite ^/core/authorize.php/core/authorize.php(.*)$ /core/authorize.php$1;location / {if (!-e $request_filename){rewrite (.*) /index.php last;}} location ~ \.php($|/){#fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_pass unix:/tmp/php-cgi.sock;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;} }
重启nginx后访问:http://xxxx:8080,开始安装。
如果要重新安装,要删除掉xxx/drupal-9.2.9/sites/default/setting.php和数据库。
安装 SMTP 模块
composer require drupal/smtp
参考:SMTP Authentication Support | Drupal
新建站点
参考文档:Multi-site - Sharing the same code base | Multisite Drupal 7 | Drupal Wiki guide on Drupal
此处不采用域名=>目录的对应方式(具体可参考官方文档),使用sites.php来建立对应关系。
在xxx/drupal-9.2.9/sites/目录下新建目录:
cd xxx/drupal-9.2.9/sites/
mkdir a.drupal/
复制setting.php文件
cp default/default.settings.php a.drupal/settings.php
添加允许访问的域名:
$settings['trusted_host_patterns'] = [ 'a.drupal', ];
复制sites.php
cp example.sites.php sites.php
在sites.php中添加:
$sites = [ '域名'=>'目录名', // 域名对应的 sites/ 中的目录 '8080.a.drupal'=>'a.drupal', // 精确匹配(规则:端口号在前),如果目录名写的不对则会匹配到下一条 'a.drupal'=>'a.drupal', // 如果没有上一条有端口的则会匹配这一条(有写精确匹配可以不要这一条) ];
修改hosts文件
1.2.3.4 a.drupal
访问::8080 新站点开始安装。
更多推荐
Drupal部署
发布评论