diff --git a/roles/wsgi_website/templates/nginx_site.j2 b/roles/wsgi_website/templates/nginx_site.j2 index dbc13bc3e954b107d751bf3f6bc1d248a1123480..fa96494fceba87997bb257b2019d6ecfc9fd1dde 100644 --- a/roles/wsgi_website/templates/nginx_site.j2 +++ b/roles/wsgi_website/templates/nginx_site.j2 @@ -5,17 +5,21 @@ server { server_name {{ fqdn }}; + {% if rewrites -%} # Site rewrites. {% for rewrite in rewrites -%} rewrite {{ rewrite }}; - {% endfor %} + {% endfor -%} + {% endif %} + {% if static_locations -%} # Static locations {% for location in static_locations -%} location {{ location }} { try_files $uri $uri/ =404; } - {% endfor %} + {% endfor -%} + {% endif %} # Pass remaining requests to the WSGI server. location / {