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="