我们将 VirtualHost 条目存储在站点的 SVN 存储库中的 (dev|staging|live).conf 文件中。
例如:
/var/www/vhosts/site1.com/live.conf
/var/www/vhosts/site2.com/live.conf
Run Code Online (Sandbox Code Playgroud)
能够自动包含它们会很方便,例如:Include /var/www/vhosts/*/live.conf
但这似乎不起作用。
我们用一个简单的 PHP 脚本解决了这个问题:
$vhosts = '';
foreach (glob('/var/www/vhosts/*/vhost/dev.conf') as $filename) {
$vhosts .= "\nInclude $filename";
}
file_put_contents('/var/www/vhosts/vhosts.conf', $vhosts);
Run Code Online (Sandbox Code Playgroud)
但是,我希望简化并让 Apache (2.2.3) 完成这项工作,而无需 PHP 步骤。
可能的?
apache-2.2 ×1