diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php index 1666b4c40d277f975ef28b7248683e229cf44290..3a0f87af1e6967968197e15c29d115e6a389ed24 100644 --- a/install/lib/installer_base.lib.php +++ b/install/lib/installer_base.lib.php @@ -2553,7 +2553,7 @@ class installer_base { $tpl->setVar('apps_vhost_dir',$conf['web']['website_basedir'].'/apps'); $tpl->setVar('apps_vhost_basedir',$conf['web']['website_basedir']); $tpl->setVar('apps_vhost_servername',$apps_vhost_servername); - if(is_file($install_dir.'/interface/ssl/ispserver.crt') && is_file($install_dir.'/interface/ssl/ispserver.key')) { + if(is_file($conf['ispconfig_install_dir'].'/interface/ssl/ispserver.crt') && is_file($conf['ispconfig_install_dir'].'/interface/ssl/ispserver.key')) { $tpl->setVar('ssl_comment',''); } else { $tpl->setVar('ssl_comment','#'); @@ -2636,6 +2636,15 @@ class installer_base { // Dont just copy over the virtualhost template but add some custom settings $content = rfsel($conf['ispconfig_install_dir'].'/server/conf-custom/install/nginx_apps.vhost.master', 'tpl/nginx_apps.vhost.master'); + // Enable SSL if a cert is in place. + if(is_file($conf['ispconfig_install_dir'].'/interface/ssl/ispserver.crt') && is_file($conf['ispconfig_install_dir'].'/interface/ssl/ispserver.key')) { + $content = str_replace('{ssl_on}', 'ssl', $content); + $content = str_replace('{ssl_comment}', '', $content); + } else { + $content = str_replace('{ssl_on}', '', $content); + $content = str_replace('{ssl_comment}', '#', $content); + } + if($conf['web']['apps_vhost_ip'] == '_default_'){ $apps_vhost_ip = ''; } else { @@ -2678,10 +2687,6 @@ class installer_base { $content = str_replace('{use_tcp}', $use_tcp, $content); $content = str_replace('{use_socket}', $use_socket, $content); - // SSL in apps vhost is off by default. Might change later. - $content = str_replace('{ssl_on}', '', $content); - $content = str_replace('{ssl_comment}', '#', $content); - // Fix socket path on PHP 7 systems if(file_exists('/var/run/php/php7.0-fpm.sock')) $content = str_replace('/var/run/php5-fpm.sock', '/var/run/php/php7.0-fpm.sock', $content); if(file_exists('/var/run/php/php7.1-fpm.sock')) $content = str_replace('/var/run/php5-fpm.sock', '/var/run/php/php7.1-fpm.sock', $content); diff --git a/install/tpl/nginx_apps.vhost.master b/install/tpl/nginx_apps.vhost.master index b91d1a16c5f05344b0d6c863e28c4043334d5414..181f4c807e2ee0761e61ef26f3f0589153703ca2 100644 --- a/install/tpl/nginx_apps.vhost.master +++ b/install/tpl/nginx_apps.vhost.master @@ -7,7 +7,7 @@ server { {ssl_comment}ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key; # redirect to https if accessed with http - {ssl_comment}error_page 497 https://$host:{vhost_port}$request_uri; + {ssl_comment}error_page 497 https://$host:{apps_vhost_port}$request_uri; server_name {apps_vhost_servername}; diff --git a/server/conf/nginx_apps.vhost.master b/server/conf/nginx_apps.vhost.master index b91d1a16c5f05344b0d6c863e28c4043334d5414..181f4c807e2ee0761e61ef26f3f0589153703ca2 100644 --- a/server/conf/nginx_apps.vhost.master +++ b/server/conf/nginx_apps.vhost.master @@ -7,7 +7,7 @@ server { {ssl_comment}ssl_certificate_key /usr/local/ispconfig/interface/ssl/ispserver.key; # redirect to https if accessed with http - {ssl_comment}error_page 497 https://$host:{vhost_port}$request_uri; + {ssl_comment}error_page 497 https://$host:{apps_vhost_port}$request_uri; server_name {apps_vhost_servername}; diff --git a/server/plugins-available/apps_vhost_plugin.inc.php b/server/plugins-available/apps_vhost_plugin.inc.php index b64adfde6e50de8a547fc7638418f2912ea62234..2195b607cd48d6c9feaac35e8e256d82da72fb1e 100644 --- a/server/plugins-available/apps_vhost_plugin.inc.php +++ b/server/plugins-available/apps_vhost_plugin.inc.php @@ -206,16 +206,14 @@ class apps_vhost_plugin { $use_socket = '#'; } - /* Check if SSL should be enabled: */ - if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) { + /* Check if SSL should be enabled: */ + if(is_file('/usr/local/ispconfig/interface/ssl/ispserver.crt') && is_file('/usr/local/ispconfig/interface/ssl/ispserver.key')) { $content = str_replace('{ssl_comment}', '', $content); $content = str_replace('{ssl_on}', 'ssl', $content); - $content = str_replace('{vhost_port}', $web_config['apps_vhost_port'], $content); - } else { + } else { $content = str_replace('{ssl_comment}', '#', $content); $content = preg_replace('/(\s)\{ssl_on\}/', '', $content); - $content = str_replace('{vhost_port}', $web_config['apps_vhost_port'], $content); - } + } $content = str_replace('{use_tcp}', $use_tcp, $content); $content = str_replace('{use_socket}', $use_socket, $content);