{%- if "default" in item.value -%}
  {%- set default_site = "default_server" -%}
{%- else -%}
  {%- set default_site = "" -%}
{%- endif -%}

server {
  listen {{ EDXAPP_LMS_NGINX_PORT }} {{ default_site }};

  {% if "ssl" in item.value and item.value['ssl'] == true -%}
  listen {{ EDXAPP_LMS_SSL_NGINX_PORT }} {{ default_site }} ssl;

  include /etc/nginx/ssl-certs.conf;

  {% endif -%}

  server_name {% for server in item.value['server_names'] %}
                
                {{ server }}{% endfor -%};

                 
  return 301 {{ item.value['redirect_destination'] }}$request_uri;
}
