# Access log configuration
daemon off;
pid {{ parameter_dict['pid'] }};
error_log {{ parameter_dict['error-log'] }};

events {
}

http {
  include {{ parameter_dict['nginx-mime'] }};
  server {
    server_name_in_redirect off;
    port_in_redirect off;
    error_log {{ parameter_dict['error-log'] }};
    access_log {{ parameter_dict['access-log'] }};
    listen [{{ parameter_dict['global-ipv6'] }}]:{{ parameter_dict['https-port'] }} ssl;
    listen {{ parameter_dict['local-ipv4'] }}:{{ parameter_dict['https-port'] }} ssl;
    ssl_certificate {{ parameter_dict['ip-access-certificate'] }};
    ssl_certificate_key {{ parameter_dict['ip-access-certificate'] }};
    default_type application/octet-stream;
    client_body_temp_path {{ parameter_dict['var'] }} 1 2;
    proxy_temp_path {{ parameter_dict['var'] }} 1 2;
    fastcgi_temp_path {{ parameter_dict['var'] }} 1 2;
    uwsgi_temp_path {{ parameter_dict['var'] }} 1 2;
    scgi_temp_path {{ parameter_dict['var'] }} 1 2;
  {% for slave, directory in slave_log_directory.items() %}
    location /{{ slave }} {
      alias {{ directory }};
      autoindex on;
      autoindex_format json;
      sendfile on;
      sendfile_max_chunk 1m;
      auth_basic "Log Access {{ slave }}";
      auth_basic_user_file "{{ slave_htpasswd[slave] | trim }}";
    }
  {% endfor %}
  }
}
