Skip to content

Commit 3b21775

Browse files
committed
Fixed Drupal multisite configs
1 parent 5138513 commit 3b21775

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

.docksal/commands/init

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ site_install_anothersite ()
111111

112112
# Initialize local settings
113113
copy_settings_file "sites/example.com/example.settings.local.php" "sites/example.com/settings.local.php"
114-
fin exec sed -i "s/%host%/${VIRTUAL_HOST}/g" "/var/www/${DOCROOT}/sites/sites.php"
115-
fin exec sed -i "s/%host%/${VIRTUAL_HOST}/g" "/var/www/drush/aliases/drupal7-advanced.aliases.drushrc.php"
116114

117115
# Create an additional database
118116
fin db create 'anothersite'
Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
<?php
22

3-
# Docker DB connection settings.
3+
# Docksal DB connection settings.
44
$databases['default']['default'] = array (
5+
'driver' => 'mysql',
56
'database' => 'anothersite',
67
'username' => 'user',
78
'password' => 'user',
89
'host' => 'db',
9-
'driver' => 'mysql',
10+
'charset' => 'utf8mb4',
11+
'collation' => 'utf8mb4_general_ci'
1012
);
1113

1214
# File system settings.
1315
$conf['file_temporary_path'] = '/tmp';
14-
# Workaround for permission issues with NFS shares in Vagrant
16+
# Workaround for permission issues with NFS shares
1517
$conf['file_chmod_directory'] = 0777;
1618
$conf['file_chmod_file'] = 0666;
1719

18-
# Reverse proxy configuration (Docksal's vhost-proxy)
19-
$conf['reverse_proxy'] = TRUE;
20-
$conf['reverse_proxy_addresses'] = array($_SERVER['REMOTE_ADDR']);
21-
// HTTPS behind reverse-proxy
22-
if (
23-
isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' &&
24-
!empty($conf['reverse_proxy']) && in_array($_SERVER['REMOTE_ADDR'], $conf['reverse_proxy_addresses'])
25-
) {
26-
$_SERVER['HTTPS'] = 'on';
27-
// This is hardcoded because there is no header specifying the original port.
28-
$_SERVER['SERVER_PORT'] = 443;
20+
# Reverse proxy configuration (Docksal vhost-proxy)
21+
if (!drupal_is_cli()) {
22+
$conf['reverse_proxy'] = TRUE;
23+
$conf['reverse_proxy_addresses'] = array($_SERVER['REMOTE_ADDR']);
24+
// HTTPS behind reverse-proxy
25+
if (
26+
isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' &&
27+
!empty($conf['reverse_proxy']) && in_array($_SERVER['REMOTE_ADDR'], $conf['reverse_proxy_addresses'])
28+
) {
29+
$_SERVER['HTTPS'] = 'on';
30+
// This is hardcoded because there is no header specifying the original port.
31+
$_SERVER['SERVER_PORT'] = 443;
32+
}
2933
}

docroot/sites/sites.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?php
22

3-
$sites['anothersite.boilerplate-drupal7-advanced.docksal.site'] = 'example.com';
3+
$sites['anothersite.drupal7-advanced.docksal.site'] = 'example.com';

drush/aliases/drupal7-advanced.aliases.drushrc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
$aliases['default'] = array(
44
'root' => '/var/www/docroot',
5-
'uri' => 'boilerplate-drupal7-advanced.docksal.site',
5+
'uri' => 'drupal7-advanced.docksal.site',
66
);
77

88
$aliases['anothersite'] = array(
99
'root' => '/var/www/docroot',
10-
'uri' => 'anothersite.boilerplate-drupal7-advanced.docksal.site',
10+
'uri' => 'anothersite.drupal7-advanced.docksal.site',
1111
);

0 commit comments

Comments
 (0)