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 %}