diff --git a/interface/lib/classes/plugin.inc.php b/interface/lib/classes/plugin.inc.php
index aaaf56797cf9a18c77ed5bc2cd3d2d912f752a1f..6a6ff703aad923e3ce1ab9e07e49b91a3506726d 100644
--- a/interface/lib/classes/plugin.inc.php
+++ b/interface/lib/classes/plugin.inc.php
@@ -43,35 +43,50 @@ class plugin {
 
 
 		if(isset($_SESSION['s']['plugin_cache'])) unset($_SESSION['s']['plugin_cache']);
-
-		$plugins_dir = ISPC_LIB_PATH.FS_DIV.'plugins'.FS_DIV;
+		
+		$plugin_dirs = array();
+		$plugin_dirs[] = ISPC_LIB_PATH.FS_DIV.'plugins'.FS_DIV;
+		
+		if(is_dir(ISPC_WEB_PATH)) {
+			if($dh = opendir(ISPC_WEB_PATH)) {
+				while(($file = readdir($dh)) !== false) {
+					if($file !== '.' && $file !== '..' && is_dir($file) && is_dir(ISPC_WEB_PATH . '/' . $file . '/lib/plugin.d')) $plugin_dirs[] = ISPC_WEB_PATH . '/' . $file . '/lib/plugin.d';
+				}
+				closedir($dh);
+			}
+		}
+		
 		$_SESSION['s']['plugin_cache'] = array();
 		$tmp_plugins = array();
-
-		if (is_dir($plugins_dir)) {
-			if ($dh = opendir($plugins_dir)) {
-				//** Go trough all files in the plugin dir
-				while (($file = readdir($dh)) !== false) {
-					if($file != '.' && $file != '..' && substr($file, -8, 8) == '.inc.php') {
-						$plugin_name = substr($file, 0, -8);
-						$tmp_plugins[$plugin_name] = $file;
+		
+		for($d = 0; $d < count($plugin_dirs); $d++) {
+			$plugins_dir = $plugin_dirs[$d];
+			if (is_dir($plugins_dir)) {
+				if ($dh = opendir($plugins_dir)) {
+					//** Go trough all files in the plugin dir
+					while (($file = readdir($dh)) !== false) {
+						if($file !== '.' && $file !== '..' && substr($file, -8, 8) == '.inc.php') {
+							$plugin_name = substr($file, 0, -8);
+							$tmp_plugins[$plugin_name] = $file;
+						}
 					}
-				}
-				//** sort the plugins by name
-				ksort($tmp_plugins);
-
-				//** load the plugins
-				foreach($tmp_plugins as $plugin_name => $file) {
-					include_once $plugins_dir.$file;
-					if($this->debug) $app->log('Loading plugin: '.$plugin_name, LOGLEVEL_DEBUG);
-					$app->loaded_plugins[$plugin_name] = new $plugin_name;
-					$app->loaded_plugins[$plugin_name]->onLoad();
+					closedir($dh);
+					//** sort the plugins by name
+					ksort($tmp_plugins);
+
+					//** load the plugins
+					foreach($tmp_plugins as $plugin_name => $file) {
+						include_once $plugins_dir.$file;
+						if($this->debug) $app->log('Loading plugin: '.$plugin_name, LOGLEVEL_DEBUG);
+						$app->loaded_plugins[$plugin_name] = new $plugin_name;
+						$app->loaded_plugins[$plugin_name]->onLoad();
+					}
+				} else {
+					$app->log('Unable to open the plugins directory: '.$plugins_dir, LOGLEVEL_ERROR);
 				}
 			} else {
-				$app->log('Unable to open the plugins directory: '.$plugins_dir, LOGLEVEL_ERROR);
+				$app->log('Plugins directory missing: '.$plugins_dir, LOGLEVEL_ERROR);
 			}
-		} else {
-			$app->log('Plugins directory missing: '.$plugins_dir, LOGLEVEL_ERROR);
 		}
 
 	}
diff --git a/interface/lib/classes/tform_actions.inc.php b/interface/lib/classes/tform_actions.inc.php
index f172fea1f4c5fceb824281c8e1b54ee7cc6b3446..84613866aa48578c2db907fe1d7e2cb6276a1026 100644
--- a/interface/lib/classes/tform_actions.inc.php
+++ b/interface/lib/classes/tform_actions.inc.php
@@ -594,7 +594,7 @@ class tform_actions {
 				$app->load($plugin_class);
 				$this->plugins[$plugin_name] = new $plugin_class;
 				$this->plugins[$plugin_name]->setOptions($plugin_name, $plugin_settings['options']);
-				// Make the data of the form easily accessible for the plugib
+				// Make the data of the form easily accessible for the plugin
 				$this->plugins[$plugin_name]->form = $this;
 				$this->plugins[$plugin_name]->onLoad();
 			}
diff --git a/interface/lib/classes/tform_base.inc.php b/interface/lib/classes/tform_base.inc.php
index 4b5a76c5f14a7406eb50c7d5383b771c21b3cf29..95162a7c682355d30cce3b9e73902a9f11503e85 100644
--- a/interface/lib/classes/tform_base.inc.php
+++ b/interface/lib/classes/tform_base.inc.php
@@ -126,6 +126,7 @@ class tform_base {
 	function loadFormDef($file, $module = '') {
 		global $app, $conf;
 
+		$app->plugin->raiseEvent('on_before_formdef', $module);
 		include $file;
 		$this->formDef = $form;
 
@@ -150,6 +151,8 @@ class tform_base {
 			$wb = $app->functions->array_merge($wb_global, $wb);
 		}
 		if(isset($wb_global)) unset($wb_global);
+		
+		$app->plugin->raiseEvent('on_after_formdef', $module);
 
 		$this->wordbook = $wb;
 
diff --git a/interface/web/admin/templates/directive_snippets_edit.htm b/interface/web/admin/templates/directive_snippets_edit.htm
index 21b76867ec12d468ff7371222951e1ef809276aa..054c5bcec72155f339d99d85a6cbcb1f50eb6d34 100644
--- a/interface/web/admin/templates/directive_snippets_edit.htm
+++ b/interface/web/admin/templates/directive_snippets_edit.htm
@@ -16,7 +16,7 @@
             </div>
 			<div class="form-group">
                 <label for="snippet" class="col-sm-3 control-label">{tmpl_var name='snippet_txt'}</label>
-                <div class="col-sm-9"><textarea class="form-control" name="snippet" id="snippet" rows='10' cols='50'>{tmpl_var name='snippet'}</textarea></div><span class="nginx"> &nbsp; {tmpl_var name='variables_txt'}: </span><a href="javascript:void(0);" class="addPlaceholder nginx">{DOCROOT}</a><span class="nginx">, </span><a href="javascript:void(0);" class="addPlaceholder nginx">{FASTCGIPASS}</a>
+                <div class="col-sm-9"><textarea class="form-control" name="snippet" id="snippet" rows='10' cols='50'>{tmpl_var name='snippet'}</textarea></div><span> &nbsp; {tmpl_var name='variables_txt'}: </span><a href="javascript:void(0);" class="addPlaceholder">{DOCROOT}</a>, <a href="javascript:void(0);" class="addPlaceholder">{DOCROOT_CLIENT}</a><span class="nginx">, </span><a href="javascript:void(0);" class="addPlaceholder nginx">{FASTCGIPASS}</a>
             </div>
 			<div class="form-group php">
                 <label class="col-sm-3 control-label">{tmpl_var name='required_php_snippets_txt'}</label>
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index b18fe46ade5c7c161a0d50ed8180a68a7224ae7f..818cfd81291d44b556da112218b98ef3f53eaa4b 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -1091,7 +1091,10 @@ class apache2_plugin {
 		// Make sure we only have Unix linebreaks
 		$vhost_data['apache_directives'] = str_replace("\r\n", "\n", $vhost_data['apache_directives']);
 		$vhost_data['apache_directives'] = str_replace("\r", "\n", $vhost_data['apache_directives']);
-		$trans = array('{DOCROOT}' => $vhost_data['web_document_root_www']);
+		$trans = array(
+			'{DOCROOT}' => $vhost_data['web_document_root_www'],
+			'{DOCROOT_CLIENT}' => $vhost_data['web_document_root']
+		);
 		$vhost_data['apache_directives'] = strtr($vhost_data['apache_directives'], $trans);
 
 		// Check if a SSL cert exists
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index a31e639ecd8c2329061e43ba88e939bfc6a28196..aaab39b12763098a22232c4b7561407d5cf2f7d8 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -1133,7 +1133,11 @@ class nginx_plugin {
 		$nginx_directives = str_replace("\r", "\n", $nginx_directives);
 		$nginx_directive_lines = explode("\n", $nginx_directives);
 		if(is_array($nginx_directive_lines) && !empty($nginx_directive_lines)){
-			$trans = array('{DOCROOT}' => $vhost_data['web_document_root_www'], '{FASTCGIPASS}' => 'fastcgi_pass '.($data['new']['php_fpm_use_socket'] == 'y'? 'unix:'.$fpm_socket : '127.0.0.1:'.$vhost_data['fpm_port']).';');
+			$trans = array(
+				'{DOCROOT}' => $vhost_data['web_document_root_www'],
+				'{DOCROOT_CLIENT}' => $vhost_data['web_document_root'],
+				'{FASTCGIPASS}' => 'fastcgi_pass '.($data['new']['php_fpm_use_socket'] == 'y'? 'unix:'.$fpm_socket : '127.0.0.1:'.$vhost_data['fpm_port']).';'
+			);
 			foreach($nginx_directive_lines as $nginx_directive_line){
 				$final_nginx_directives[] = array('nginx_directive' => strtr($nginx_directive_line, $trans));
 			}