.dev/useful/nginx_conf/nginx.conf

Summary

Maintainability
Test Coverage
error_log  logs/error.log  error;
#error_log  logs/error.log  debug;
pid logs/nginx.pid;

worker_processes  2;
events {
    worker_connections  1024;
    use epoll;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    server_tokens off;

    log_format  custom '$remote_addr#|#$time_local#|#$status#|#$request#|#$body_bytes_sent#|#$http_referer#|#$http_user_agent#|#$http_x_forwarded_for#|#$cookie_irlogged#|#$host#|#$upstream_cache_status#|#$upstream_http_cache_control#|#$upstream_http_expires#|#$upstream_response_time#|#$upstream_status#|#$geoip_country_code#|#$upstream_addr#|#$upstream_http_x_forwarded_for#|#$upstream_http_x_program_id#|#$upstream_http_x_version_id#|#$upstream_http_x_lang_id#|#$upstream_http_x_host_id#|#$upstream_http_x_search_query#|#$upstream_http_x_search_count#|#$var_cookie_search#|#$var_cookie_special#|#$upstream_http_x_action_id#|#$server_addr#|#$referer_search_query';

    access_log  logs/access.log  custom;
    log_not_found off;

    client_header_timeout 1m;
    client_body_timeout    3m;
    send_timeout 3m;

    client_max_body_size 32m;

    gzip  on;
    gzip_http_version 1.1;
    gzip_comp_level 3;
    gzip_min_length  1100;
    gzip_buffers     64 8k;
    gzip_proxied any;
    # these mime types will be gzipped automatically
    gzip_types       text/plain html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_disable "msie6";

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout  30;
    msie_padding on;

    # geoip database connection
    geoip_country  /usr/local/nginx/conf/geoip.dat;

##    limit_conn_zone $binary_remote_addr zone=limit_one:10m;
##    limit_conn_log_level error;

    # proxy requests cache settings
    proxy_cache_path /usr/local/nginx/cache/html inactive=5m levels= keys_zone=htmlcache:500m max_size=2000m;

    fastcgi_cache_path /usr/local/nginx/cache/fcgi inactive=5m levels=1:2 keys_zone=fcgicache:500m max_size=2000m;

    upstream upstream_fastcgi {
        server unix:/var/run/php5-fpm.sock;
    }
#    upstream upstream_sphinx {
#        drizzle_server 127.0.0.1:3307 protocol=mysql;
#        drizzle_keepalive max=100 mode=single overflow=reject;
#    }

    lua_shared_dict lsm 20m;

    include /usr/local/nginx/conf/sites/*.conf;
}