Skip to content

Commit d0356fd

Browse files
author
Till Brehm
committed
Fixed: FS#3169 - Defaults "apps" Port 8081 overwrites custom port
1 parent 65584a9 commit d0356fd

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

install/lib/install.lib.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,32 @@ function get_ispconfig_port_number() {
718718
}
719719
}
720720

721+
/*
722+
* Get the port number of the ISPConfig apps vhost
723+
*/
724+
725+
function get_apps_vhost_port_number() {
726+
global $conf;
727+
if($conf['nginx']['installed'] == true){
728+
$ispconfig_vhost_file = $conf['nginx']['vhost_conf_dir'].'/apps.vhost';
729+
$regex = '/listen (\d+)/';
730+
} else {
731+
$ispconfig_vhost_file = $conf['apache']['vhost_conf_dir'].'/apps.vhost';
732+
$regex = '/\<VirtualHost.*\:(\d{1,})\>/';
733+
}
734+
735+
if(is_file($ispconfig_vhost_file)) {
736+
$tmp = file_get_contents($ispconfig_vhost_file);
737+
preg_match($regex, $tmp, $matches);
738+
$port_number = @intval($matches[1]);
739+
if($port_number > 0) {
740+
return $port_number;
741+
} else {
742+
return '8081';
743+
}
744+
}
745+
}
746+
721747
/*
722748
* Get the port number of the ISPConfig controlpanel vhost
723749
*/

install/lib/installer_base.lib.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,6 +1511,11 @@ public function configure_apps_vhost() {
15111511
$vhost_conf_dir = $conf['apache']['vhost_conf_dir'];
15121512
$vhost_conf_enabled_dir = $conf['apache']['vhost_conf_enabled_dir'];
15131513
$apps_vhost_servername = ($conf['web']['apps_vhost_servername'] == '')?'':'ServerName '.$conf['web']['apps_vhost_servername'];
1514+
1515+
//* Get the apps vhost port
1516+
if($this->is_update == true) {
1517+
$conf['web']['apps_vhost_port'] = get_apps_vhost_port_number();
1518+
}
15141519

15151520
// Dont just copy over the virtualhost template but add some custom settings
15161521
$content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/apache_apps.vhost.master', 'tpl/apache_apps.vhost.master');

0 commit comments

Comments
 (0)