diff --git a/server/conf/apache.conf.master b/server/conf/apache.conf.master deleted file mode 100644 index 6f8f7fc7c6d5f55f775eb34a5c10b5811829ba25..0000000000000000000000000000000000000000 --- a/server/conf/apache.conf.master +++ /dev/null @@ -1,3 +0,0 @@ - -NameVirtualHost *:80 -NameVirtualHost *:443 diff --git a/server/conf/apache_ispconfig.conf.master b/server/conf/apache_ispconfig.conf.master new file mode 100644 index 0000000000000000000000000000000000000000..ed6b67ab4607b9a2f5ffc788ae129830b2174627 --- /dev/null +++ b/server/conf/apache_ispconfig.conf.master @@ -0,0 +1,12 @@ + +################################################ +# ISPConfig Logfile configuration for vlogger +################################################ + +LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined_ispconfig +CustomLog "| /usr/sbin/vlogger -s access.log -t \"%Y%m%d-access.log\" /var/log/ispconfig/httpd" combined_ispconfig + +<tmpl_loop name="ip_adresses"> +NameVirtualHost {tmpl_var name="ip_address"}:80 +NameVirtualHost {tmpl_var name="ip_address"}:443 +</tmpl_loop> diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 38732ed2629b974d912766e185f538ad177219a4..7e1c3a40977ec5b1e66ded2e959128167c102d7e 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -721,9 +721,24 @@ class apache2_plugin { function server_ip($event_name,$data) { global $app, $conf; - // Here we write the name virtualhost directives - // NameVirtualHost IP:80 - // NameVirtualHost IP:443 + // load the server configuration options + $app->uses("getconf"); + $web_config = $app->getconf->get_server_config($conf["server_id"], 'web'); + + $app->load('tpl'); + + $tpl = new tpl(); + $tpl->newTemplate("apache_ispconfig.conf.master"); + $records = $app->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ".$conf["server_id"]." AND virtualhost = 'y'"); + + if(count($records) > 0) { + $tpl->setLoop('ip_adresses',$records); + } + + $vhost_file = escapeshellcmd($web_config["vhost_conf_dir"].'/ispconfig.conf'); + file_put_contents($vhost_file,$tpl->grab()); + $app->log("Writing the conf file: ispconfig.conf",LOGLEVEL_DEBUG); + unset($tpl); }