worker_processes  1;

error_log  stderr;

pid        /srv/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    access_log off;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    # spool uploads to disk instead of clobbering downstream servers
    client_body_temp_path /srv/var/nginx/client-body 1 2;
    client_max_body_size 2g;
    client_body_buffer_size    128k;

    server_names_hash_max_size  4096;
    server_names_hash_bucket_size 512;

    server_tokens       off;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         off;

    keepalive_timeout   5;

    ## Compression
    gzip on;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_min_length  1100;
    gzip_buffers 16 8k;
    gzip_types text/xml text/plain text/css application/x-javascript application/xml application/xml+rss text/javascript application/json;#text/html
    # Some version of IE 6 don't handle compression well on some mime-types, 
    # so just disable for them
    gzip_disable "MSIE [1-6].(?!.*SV1)";
    # Set a vary header so downstream proxies don't send cached gzipped 
    # content to IE6
    gzip_vary on;

    # proxy settings
    set_real_ip_from  83.167.253.64/27;
    set_real_ip_from  10.0.0.0/8;
    set_real_ip_from  2a01:430:225::/64;
    real_ip_header X-Real-IP;

    proxy_set_header   Host             $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Real-Port      $remote_port;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_max_temp_file_size 0;

    proxy_connect_timeout      600;
    proxy_send_timeout         600;
    proxy_read_timeout         600;

    proxy_buffer_size          512k;
    proxy_buffers              4 512k;
    proxy_busy_buffers_size    512k;
    proxy_temp_file_write_size 512k;

    proxy_temp_path /srv/var/nginx/cache/;

    map $http_x_forwarded_proto $thescheme {
        default $scheme;
        https https;
    }
    proxy_set_header X-Forwarded-Proto $thescheme;

    include             /srv/conf/nginx.d/*;
}
