From f57ab085949f7aa510441f518321f32186e143f7 Mon Sep 17 00:00:00 2001 From: Emilien Mantel Date: Tue, 3 Nov 2015 14:31:50 +0100 Subject: [PATCH] location / can be overwrited --- templates/etc/nginx/sites-available/_base.j2 | 2 ++ tests/test.yml | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/templates/etc/nginx/sites-available/_base.j2 b/templates/etc/nginx/sites-available/_base.j2 index e709df4..317f0de 100644 --- a/templates/etc/nginx/sites-available/_base.j2 +++ b/templates/etc/nginx/sites-available/_base.j2 @@ -28,11 +28,13 @@ server { {% endfor %} {% endif %} +{% if not __location.has_key('/') %} location / { {% block template_try_files %} try_files {{ override_try_files | default('$uri $uri/ =404') }}; {% endblock %} } +{% endif %} {% block template_upstream_location %} {% endblock %} diff --git a/tests/test.yml b/tests/test.yml index 0e05bb8..de70fd6 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -30,6 +30,11 @@ - 'return 403;' '/gunther': - 'return 404;' + - name: 'test-location.local' + template: '_base' + location: + '/': + - 'alias /var/tmp;' - name: 'test-php.local' upstream_params: - 'fastcgi_param FOO bar;' @@ -53,7 +58,8 @@ copy: dest="{{ nginx_root }}/{{ item }}/public/index.php" content="