From f9251445f3966e34a8b491f312de85a31be1fc54 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 17 Dec 2018 16:26:26 +0100 Subject: [PATCH] Add a special target for the php redirections. --- nginx/templates/nginx-virthost.j2 | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/nginx/templates/nginx-virthost.j2 b/nginx/templates/nginx-virthost.j2 index 426d1309..63dda5ab 100644 --- a/nginx/templates/nginx-virthost.j2 +++ b/nginx/templates/nginx-virthost.j2 @@ -123,7 +123,7 @@ server { {% endif %} {% if item.locations is defined %} - {% for location in item.locations %} + {% for location in item.locations -%} location {{ location.location }} { @@ -137,6 +137,15 @@ server { {% if location.target is defined %} proxy_pass {{ location.target }}; + {% elif location.php_target is defined %} + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass {{ location.php_target }}; + fastcgi_index index.php; + #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + #fastcgi_param REMOTE_ADDR $http_x_forwarded_for; + #fastcgi_param REMOTE_ADDR $remote_addr; + include fastcgi_params; {% endif %} {% if location.websockets is defined and location.websockets %} @@ -274,7 +283,7 @@ server { {% endif %} {% if item.locations is defined %} - {% for location in item.locations %} + {% for location in item.locations -%} location {{ location.location }} { {% if nginx_cors_enabled %} @@ -287,6 +296,15 @@ server { {% if location.target is defined %} proxy_pass {{ location.target }}; + {% elif location.php_target is defined %} + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass {{ location.php_target }}; + fastcgi_index index.php; + #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + #fastcgi_param REMOTE_ADDR $http_x_forwarded_for; + #fastcgi_param REMOTE_ADDR $remote_addr; + include fastcgi_params; {% endif %} {% if location.websockets is defined and location.websockets %}