{% extends "default.conf.j2" %}
{% block nginx_tpl_block_location %}

{%   if (item.location is defined and item.location) or (item.location_list is defined and item.location_list) %}
{%     if item.location_list is defined and item.location_list %}
{{       print_location_list(item.location_list) }}
{%     endif %}
{%     if item.location is defined and item.location %}
{{       print_location(item.location, item.location_allow, item.location_referers, item.location_deny) }}
{%     endif %}
{%   else %}
        location / {
{%     block nginx_tpl_block_location_root %}
                try_files {{ (([ item.try_files ] if item.try_files is string else item.try_files) if item.try_files|d() else nginx_default_try_files) | join(' ') }} =404;
{%     endblock %}
        }
{%   endif %}

{%   if nginx_flavor == 'passenger' %}
        passenger_enabled on;
{%     if item.passenger_ruby is defined and item.passenger_ruby %}
        passenger_ruby {{ item.passenger_ruby }};
{%     endif %}
{%     if item.passenger_app_env is defined and item.passenger_app_env %}
        passenger_app_env {{ item.passenger_app_env }};
{%     endif %}
{%     if item.passenger_user is defined and item.passenger_user %}
        passenger_user {{ item.passenger_user }};
{%       if item.passenger_group is defined and item.passenger_group %}
        passenger_group {{ item.passenger_group }};
{%       else %}
        passenger_group {{ item.passenger_user }};
{%       endif %}
{%     endif %}
        passenger_min_instances {{ item.passenger_min_instances | default(nginx_passenger_default_min_instances) }};
{%     if item.passenger_options is defined and item.passenger_options %}
{{ item.passenger_options | indent(8, true) | regex_replace("(?m)^\s*$", "") }}
{%     endif %}

{%   endif %}
{% endblock %}
