From c8c13a72fe8837e740d9e16a65c607bc63837fd2 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Tue, 4 Sep 2012 12:11:13 +0000
Subject: [PATCH] - Added random PHP dummy file to "location ~ \.php$ {}".

---
 server/conf/nginx_vhost.conf.master           | 2 +-
 server/plugins-available/nginx_plugin.inc.php | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/conf/nginx_vhost.conf.master b/server/conf/nginx_vhost.conf.master
index 1d111531a..628480013 100644
--- a/server/conf/nginx_vhost.conf.master
+++ b/server/conf/nginx_vhost.conf.master
@@ -106,7 +106,7 @@ server {
         }
 
         location ~ \.php$ {
-            try_files @php @php;
+            try_files <tmpl_var name='rnd_php_dummy_file'> @php;
         }
 
 <tmpl_if name='php' op='==' value='php-fpm'>
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 8e23e9f1b..093719984 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -819,6 +819,7 @@ class nginx_plugin {
 		$tpl->setVar('use_socket', $use_socket);
 		$fpm_socket = $socket_dir.$pool_name.'.sock';
 		$tpl->setVar('fpm_socket', $fpm_socket);
+		$tpl->setVar('rnd_php_dummy_file', '/'.md5(uniqid(microtime(),1)).'.htm');
 		$vhost_data['fpm_port'] = $web_config['php_fpm_start_port'] + $data['new']['domain_id'] - 1;
 		
 		// backwards compatibility; since ISPConfig 3.0.5, the PHP mode for nginx is called 'php-fpm' instead of 'fast-cgi'. The following line makes sure that old web sites that have 'fast-cgi' in the database still get PHP-FPM support.
-- 
GitLab