diff --git a/README.md b/README.md index f10cb69..7fe63d1 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ You can see many examples in: [tests/test.yml](tests/test.yml). - `location`: (O) Add new custom locations (it does not overwrite!) - `more`: (O) Add more custom infos. - `upstream_params`: (O) Add upstream params (useful when you want to pass variables to PHP) + - `override_try_files`: (O) overrides default try\_files defined in template (O) : Optional (M) : Mandatory diff --git a/templates/etc/nginx/sites-available/_base.j2 b/templates/etc/nginx/sites-available/_base.j2 index 9ab590b..b8b67d6 100644 --- a/templates/etc/nginx/sites-available/_base.j2 +++ b/templates/etc/nginx/sites-available/_base.j2 @@ -30,7 +30,7 @@ server { location / { {% block template_try_files %} - try_files $uri $uri/ =404; + try_files {{ override_try_files | default('$uri $uri/ =404') }}; {% endblock %} } diff --git a/templates/etc/nginx/sites-available/_php.j2 b/templates/etc/nginx/sites-available/_php.j2 index a857d4d..5cc7332 100644 --- a/templates/etc/nginx/sites-available/_php.j2 +++ b/templates/etc/nginx/sites-available/_php.j2 @@ -4,7 +4,7 @@ {% endblock %} {% block template_try_files %} - try_files $uri $uri/ /index.php; + try_files {{ override_try_files | default('$uri $uri/ /index.php') }}; {% endblock %} {% block template_upstream_location %} diff --git a/tests/test.yml b/tests/test.yml index 71f199c..fd2c259 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -21,6 +21,7 @@ - 'test-alias.local' - 'test2-alias.local' template: '_base' + override_try_files: '$uri $uri index.htm index.html' more: - 'autoindex off;' location: