user ecom ecom; worker_processes 4; worker_rlimit_nofile 51200; error_log /data/ecom/nginx/logs/error.log notice; pid /data/ecom/nginx/logs/nginx.pid; events { use epoll; worker_connections 51200; accept_mutex off; } http { include mime.types; default_type application/octet-stream; # log config --- Use crontab and bash script to rotate the log. See crontab for details log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" "$request_time"'; access_log /data/ecom/nginx/logs/access.log main; log_not_found off; server_tokens off; sendfile on; tcp_nopush on; client_body_timeout 60; keepalive_timeout 15; keepalive_requests 100; client_header_timeout 60; send_timeout 60; client_max_body_size 100m; client_body_buffer_size 1024k; # mod_gzip configurations gzip on; gzip_http_version 1.0; gzip_comp_level 6; gzip_min_length 1024; gzip_proxied any; gzip_vary on; gzip_disable msie6; gzip_buffers 64 8k; gzip_types text/xml text/plain text/css application/javascript application/x-javascript application/rss+xml; # mod_http_proxy proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_redirect off; proxy_buffers 64 8k; proxy_connect_timeout 60; proxy_ignore_client_abort on; # fight DDoS attack, tune the numbers below according your application!!! #limit_req_zone $binary_remote_addr zone=req:20m rate=200r/s; #limit_req zone=req burst=100; #limit_zone conn $binary_remote_addr 20m; #limit_conn conn 200; server_names_hash_max_size 1024; server_names_hash_bucket_size 256; upstream adm { #server 10.26.27.190:9090 max_fails=2 fail_timeout=15s; #server 10.26.27.191:9090 max_fails=2 fail_timeout=15s; #server 10.26.27.192:9090 max_fails=2 fail_timeout=15s; #server 10.26.27.193:9090 max_fails=2 fail_timeout=15s; #server 10.26.27.194:9090 max_fails=2 fail_timeout=15s; #server 10.26.31.118:9090 max_fails=2 fail_timeout=15s weight=3; #server 10.26.31.119:9090 max_fails=2 fail_timeout=15s weight=3; #server 10.26.31.120:9090 max_fails=2 fail_timeout=15s weight=3; #server 10.26.31.121:9090 max_fails=2 fail_timeout=15s weight=3; #server 10.26.31.122:9090 max_fails=2 fail_timeout=15s weight=3; server 10.26.31.105:9090 max_fails=2 fail_timeout=15s weight=3; server 10.26.31.106:9090 max_fails=2 fail_timeout=15s weight=3; server 10.26.31.107:9090 max_fails=2 fail_timeout=15s weight=3; server 10.26.31.108:9090 max_fails=2 fail_timeout=15s weight=3; server 10.26.31.109:9090 max_fails=2 fail_timeout=15s weight=3; #server 10.26.31.110:9090 max_fails=2 fail_timeout=15s weight=3; } server { listen 80 default; server_name _; return 500; } server { listen 80; server_name adm.easou.com adm.appeasou.com; #charset koi8-r; access_log /data/ecom/nginx/logs/adm_access.log main; location / { root html; index index.html index.htm; proxy_next_upstream http_502 http_503 http_504 http_500 http_404 error timeout; proxy_pass http://adm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location /nginx_status { stub_status on; access_log off; allow all; deny all; } } }