user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
        worker_connections 768;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # increase header buffer for for https://edx-wiki.atlassian.net/browse/LMS-467&gt
        # see http://orensol.com/2009/01/18/nginx-and-weird-400-bad-request-responses/
        large_client_header_buffers 4 16k;
        # server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # Logging Settings
        ##

        log_format {{ NGINX_LOG_FORMAT_NAME }} '$http_x_forwarded_for - $remote_addr - $remote_user [$time_local]  '
                            '"$request" $status $body_bytes_sent $request_time '
                            '"$http_referer" "$http_user_agent"';

        log_format ssl_combined '$remote_addr - $ssl_client_s_dn - "$upstream_addr" [$time_local]  '
                                '"$request" $status $body_bytes_sent $request_time '
                                '"$http_referer" "$http_user_agent"';

        access_log {{ nginx_log_dir }}/access.log p_combined;
        error_log {{ nginx_log_dir }}/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;
        gzip_disable "msie6";

        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_buffers 16 8k;
        gzip_http_version 1.1;
        gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

        ##
        # Virtual Host Configs
        ##

        include {{ nginx_sites_enabled_dir }}/*;
        include {{ nginx_conf_dir }}/*.conf;
}

