ISPConfig port detection failure when ISPConfig use Apache + an NGINX is installed but not used by ISPConfig
Summary
When NGINX is installed alongside the Apache2 of ISPConfig, the port detection during ISPConfig update is not working (becomes empty). Same bug happens with the apps vhost.
Steps to reproduce
- Install ISPConfig with Apache2
- Install NGINX and make it listening any port other than 80, 443 and the ISPConfig or apps vhost port (default 8080/8081).
- Update ISPConfig and see "ISPConfig port" empty
- Once ISPConfig updated, ports are empty on app.vhost and ispconfig.vhost configuration file in Apache
Correct behaviour
The ISPConfig port during update.php wizard should state the current port set in Apache2.
Environment
Server OS + version: Debian 11 ISPConfig version: 3.2.7p1 Software version of the related software: (any version of nginx and apache2)
Proposed fix
Instead of checking if NGINX or Apache2 is installed, installation should check if ISPConfig is configured with NGINX or with Apache2:
root@vps72943:/usr/local/ispconfig# git diff install/lib/install.lib.php
diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index 6ff32bb78..6741523b6 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -842,7 +842,8 @@ function is_installed($appname) {
function get_ispconfig_port_number() {
global $conf;
- if($conf['nginx']['installed'] == true){
+
+ if(is_file($conf['nginx']['vhost_conf_dir'].'/ispconfig.vhost')) {
$ispconfig_vhost_file = $conf['nginx']['vhost_conf_dir'].'/ispconfig.vhost';
$regex = '/listen (\d+)/';
} else {
@@ -868,7 +869,7 @@ function get_ispconfig_port_number() {
function get_apps_vhost_port_number() {
global $conf;
- if($conf['nginx']['installed'] == true){
+ if(is_file($conf['nginx']['vhost_conf_dir'].'/apps.vhost')) {
$ispconfig_vhost_file = $conf['nginx']['vhost_conf_dir'].'/apps.vhost';
$regex = '/listen (\d+)/';
} else {