daemon  off;
pid %(path)/nginx.pid;
worker_processes  2;

error_log %(path)/error.log info;

events {
        worker_connections  1024;
        use epoll;
}

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

        %(ssl)

        log_format main
                '$remote_addr - $remote_user [$time_local] '
                '"$request" $status $bytes_sent '
                '"$http_referer" "$http_user_agent" '
                '"$gzip_ratio"';

        error_log %(path)/error.log info;

        client_header_timeout   10m;
        client_body_timeout     10m;
        send_timeout            10m;

        client_body_temp_path %(path)/client_body_temp;
        proxy_temp_path %(path)/proxy_temp;
        fastcgi_temp_path %(path)/fastcgi_temp;


        connection_pool_size            256;
        client_header_buffer_size       1k;
        large_client_header_buffers     4 2k;
        request_pool_size               4k;

        gzip on;
        gzip_min_length 1100;
        gzip_buffers    4 8k;
        gzip_types      text/plain;

        output_buffers  1 32k;
        postpone_output 1460;

        sendfile        on;
        tcp_nopush      on;
        tcp_nodelay     on;

        keepalive_timeout       75 20;

        ignore_invalid_headers  on;

        server {
                listen %(port);
                server_name %(host);
                # site_media - folder in uri for static files
                location ^~ /media  {
                        root %(media)/..;
                        }
                location ^~ /admin/media  {
                        root /usr/lib/python%(version)/site-packages/django/contrib;
                        }
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov) {
  access_log   off;
  expires      30d; 
}
                location / {
                        # host and port to fastcgi server
                        fastcgi_pass 127.0.0.1:9295;
                        fastcgi_param PATH_INFO $fastcgi_script_name;
                        fastcgi_param REQUEST_METHOD $request_method;
                        fastcgi_param QUERY_STRING $query_string;
                        fastcgi_param CONTENT_TYPE $content_type;
                        fastcgi_param CONTENT_LENGTH $content_length;
                        fastcgi_param SERVER_NAME $server_name;
                        fastcgi_param SERVER_PORT $server_port;
                        fastcgi_param SERVER_PROTOCOL $server_protocol;
                        fastcgi_pass_header Authorization;
                        fastcgi_intercept_errors off;
                        }
                access_log      %(path)/access.log main;
                error_log       %(path)/error.log;
                }
        }