Commit 4c803c0c authored by omega8cc's avatar omega8cc

Issue #2020089 by ergonlogic - Allow example.com and example.com/foo domains (fix)

parent 21e945ab
......@@ -31,11 +31,20 @@ class Provision_Config_Nginx_SubdirVhost extends Provision_Config_Http {
}
function write() {
$parent_site = FALSE;
foreach (d()->aliases as $alias) {
if (strpos($alias, '/')) {
$this->current_alias = $alias;
drush_log("Subdirectory alias `$alias` found. Creating vhost configuration file.", 'notice');
parent::write();
if (d($this->uri())) {
$parent_site = TRUE;
drush_log(dt('virtual host %vhost already exist for alias %alias, skipping', array('%vhost' => $this->uri(), '%alias' => $alias)), 'notice');
$site_name = '@' . $this->uri();
provision_backend_invoke($site_name, 'provision-verify');
}
else {
drush_log("Subdirectory alias `$alias` found. Creating vhost configuration file.", 'notice');
parent::write();
}
}
}
}
......@@ -48,7 +57,8 @@ class Provision_Config_Nginx_SubdirVhost extends Provision_Config_Http {
}
function filename() {
// XXX: this will OVERWRITE existing vhosts!
return $this->data['http_vhostd_path'] . '/' . $this->uri();
if (!$parent_site) {
return $this->data['http_vhostd_path'] . '/' . $this->uri();
}
}
}
......@@ -67,5 +67,9 @@ if ($this->redirection || $ssl_redirection) {
else {
print " include " . $server->include_path . "/nginx_vhost_common.conf;\n";
}
$if_subsite = $this->data['http_subdird_path'] . '/' . $this->uri;
if (subdirs_drush_load() && provision_file()->exists($if_subsite)->status()) {
print " include " . $if_subsite . "/*.conf;\n";
}
?>
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment