#{{ ansible_managed }}
user              {{ nginx_user }}  {{ nginx_group }};

worker_processes  {{ nginx_worker_processes }};

{% if nginx_pid_file %}
pid        {{ nginx_pid_file }};
{% endif %}

worker_rlimit_nofile {{ nginx_worker_rlimit_nofile }};

include {{ nginx_conf_dir }}/modules-enabled/*.conf;

{% if nginx_extra_root_params is defined and nginx_extra_root_params is iterable %}
{% for line in nginx_extra_root_params %}
{{ line }};
{% endfor %}
{% endif %}

events {
{% for v in nginx_events_params %}
        {{ v }};
{% endfor %}
}


http {

        include {{ nginx_conf_dir }}/mime.types;
        default_type application/octet-stream;
{% for v in nginx_http_params %}
        {{ v }};
{% endfor %}

        include {{ nginx_conf_dir }}/conf.d/*.conf;
        include {{ nginx_conf_dir }}/sites-enabled/*;
}

{% if nginx_stream_params or nginx_stream_configs %}
stream {

{% for v in nginx_stream_params %}
        {{ v }};
{% endfor %}

        include {{ nginx_conf_dir }}/conf.d/stream/*.conf;
}
{% endif %}

{% if nginx_daemon_mode == "off" %}
daemon off;
{% endif %}
