All pastes #2103990 Raw Edit

Untitled

public text v1 · immutable
#2103990 ·published 2012-01-19 07:34 UTC
rendered paste body
user  nginx nginx;
worker_processes  8;
#timer_resolution   100ms;
worker_rlimit_nofile 10000;
worker_priority  -5;
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
working_directory /var/log/nginx;

events {
    worker_connections  10000;
    use epoll;
}


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

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

    access_log  /var/log/nginx/access.log  main;
    log_not_found on;
    sendfile        on;
    tcp_nopush     on;
    tcp_nodelay         on;

    keepalive_timeout  60;

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

upstream nodejs {
    server 127.0.0.1:8185 fail_timeout=5s max_fails=1;
    server 127.0.0.1:8186 fail_timeout=5s max_fails=1;
    server 127.0.0.1:8187 fail_timeout=5s max_fails=1;
    server 127.0.0.1:8188 fail_timeout=5s max_fails=1;
            }

  server {
    listen *:80 default_server;
    server_name _; # This is just an invalid value which will never trigger on a real hostname.
    access_log /var/log/nginx/default.access.log main;
    server_name_in_redirect off;
    root  /usr/share/nginx/html;
        error_page  404               /404.html;
        location = /404.html {
            root   /usr/share/nginx/html;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }
        error_page 403  /403.html;
        location = /403.html {
            root   /usr/share/nginx/html;
        }
  }
    server {
        listen *:80;
        charset utf-8;
        server_name domain.ru *.domain.ru;
                access_log  /var/log/nginx/domain.ru.access.log  main;
                root  /var/vhosts/$host/www;
        location / {
                proxy_pass http://127.0.0.1:8080/;
                proxy_redirect off;
                proxy_set_header   Host             $host;
                proxy_set_header   X-Real-IP        $remote_addr;
                proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
                }
        location = /info {
                stub_status on;
                access_log  off;
                }

        location /statistic/getblocks/ {
            proxy_pass  http://nodejs;
            proxy_redirect off;

            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;


            #access_log  /var/log/nginx/getblocks.access.log;
            access_log off;

        client_max_body_size       8m;
        client_body_buffer_size    128k;

            proxy_connect_timeout      60;
            proxy_send_timeout         120;
            proxy_read_timeout         120;

            proxy_buffer_size          4k;
            proxy_buffers              8 32k;
            proxy_busy_buffers_size    64k;
            proxy_temp_file_write_size 64k;

            proxy_ignore_client_abort on;

            #root   /usr/share/nginx/html;
            #index  index.html index.htm;
        }

        location ~* ^.+\.(jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|mp3|bmp|rtf|flv|swf|avi|mp4|css|js|json)$ {
                root  /var/vhosts/$host/www;

        }

        error_page  404              /404.html;
        location = /404.html {
            root   /usr/share/nginx/html;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }
        error_page 403  /403.html;
        location = /403.html {
            root   /usr/share/nginx/html;
        }
        location ~ /\.ht {
            deny  all;
        }
}
    #include /etc/nginx/conf.d/*.conf;
server {
listen       *:80;
    server_name  img.domain.ru static.domain.ru;
        location / {
        access_log  /var/log/nginx/img.domain.ru.access.log  main;
        #access_log off;
        root /var/vhosts/img.domain.ru/www/;
        open_file_cache max=1024 inactive=600s;
        open_file_cache_valid 2000s;
        open_file_cache_min_uses 1;
        open_file_cache_errors on;
        }
        error_page  404               /404.html;
        location = /404.html {
            root   /usr/share/nginx/html;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }
        error_page 403  /403.html;
        location = /403.html {
            root   /usr/share/nginx/html;
        }
    }
}