diff --git a/server/plugins-available/apps_vhost_plugin.inc.php b/server/plugins-available/apps_vhost_plugin.inc.php
index a8797c62afcf0e8cd2c59aefd1fdb58e40f070c6..b64adfde6e50de8a547fc7638418f2912ea62234 100644
--- a/server/plugins-available/apps_vhost_plugin.inc.php
+++ b/server/plugins-available/apps_vhost_plugin.inc.php
@@ -192,6 +192,7 @@ class apps_vhost_plugin {
 			$content = str_replace('{fpm_socket}', $fpm_socket, $content);
 			$content = str_replace('{cgi_socket}', $cgi_socket, $content);
 			if(	file_exists('/var/run/php5-fpm.sock')
+                                || file_exists('/var/lib/php5-fpm/apps.sock')
 				|| file_exists('/var/run/php/php7.0-fpm.sock')
 				|| file_exists('/var/run/php/php7.1-fpm.sock')
 				|| file_exists('/var/run/php/php7.2-fpm.sock')
@@ -204,6 +205,18 @@ class apps_vhost_plugin {
 				$use_tcp = '';
 				$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')) {
+				$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 {
+				$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);