aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/apache_mod_security/apache_mod_security.inc33
1 files changed, 24 insertions, 9 deletions
diff --git a/config/apache_mod_security/apache_mod_security.inc b/config/apache_mod_security/apache_mod_security.inc
index bea52211..bc079f0e 100644
--- a/config/apache_mod_security/apache_mod_security.inc
+++ b/config/apache_mod_security/apache_mod_security.inc
@@ -64,17 +64,32 @@ EOF;
if($config['installedpackages']['apachemodsecurity']) {
foreach($config['installedpackages']['apachemodsecurity']['config'] as $ams) {
$backend_sites = "";
- if(count($ams['row']) == 1) {
- // 1 backend example
-
- } else {
- // multiple backend examples
- foreach($ams['row'] as $row)
- $backend_sites .= "{$row['webserveripaddr']} ";
- }
-
+ foreach($ams['row'] as $row)
+ $additionalsitehostnames .= "{$row['additionalsitehostnames']} ";
+ foreach($ams['row'] as $row)
+ $backend_sites .= "{$row['webserveripaddr']} ";
+ $serveradmin = $ams['siteemail'];
+ $primarysitehostname = $ams['primarysitehostname'];
+ $additionalsitehostnames = $ams['primarysitehostname'];
$sitename = str_replace(" ", "", $ams['sitename']);
$mod_proxy .= "\n";
+ // Is this item a load balancer
+ if(count($ams['row'])>1) {
+ $balancer = true;
+ $mod_proxy .= "<Proxy balancer://{$sitename}>\n";
+ foreach($ams['row'] as $row)
+ $mod_proxy .= " BalancerMember {$row['webserveripaddr']}\n";
+ $mod_proxy .= "</Proxy>\n";
+ $backend_sites = " balancer://{$sitename}\n";
+ $sitename = ""; // we are not using sitename in this case
+ $backend_sites = ""; // we are not using it, use the Proxy definition
+ }
+ if($additionalsitehostnames)
+ $mod_proxy .= " ServerAlias $additionalsitehostnames\n";
+ if($serveradmin)
+ $mod_proxy .= " ServerAdmin $serveradmin \n";
+ if($primarysitehostname)
+ $mod_proxy .= " ServerName $primarysitehostname \n";
if($backend_sites) {
$mod_proxy .= "ProxyPassReverse /{$sitename} {$backend_sites}\n";
$mod_proxy .= "ProxyPass / {$backend_sites}\n";