nginx.conf 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. user ecom ecom;
  2. worker_processes 4;
  3. worker_rlimit_nofile 51200;
  4. error_log /data/ecom/nginx/logs/error.log notice;
  5. pid /data/ecom/nginx/logs/nginx.pid;
  6. events {
  7. use epoll;
  8. worker_connections 51200;
  9. accept_mutex off;
  10. }
  11. http {
  12. include mime.types;
  13. default_type application/octet-stream;
  14. # log config --- Use crontab and bash script to rotate the log. See crontab for details
  15. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  16. '$status $body_bytes_sent "$http_referer" '
  17. '"$http_user_agent" "$http_x_forwarded_for" "$request_time"';
  18. access_log /data/ecom/nginx/logs/access.log main;
  19. log_not_found off;
  20. server_tokens off;
  21. sendfile on;
  22. tcp_nopush on;
  23. client_body_timeout 60;
  24. keepalive_timeout 15;
  25. keepalive_requests 100;
  26. client_header_timeout 60;
  27. send_timeout 60;
  28. client_max_body_size 100m;
  29. client_body_buffer_size 1024k;
  30. # mod_gzip configurations
  31. gzip on;
  32. gzip_http_version 1.0;
  33. gzip_comp_level 6;
  34. gzip_min_length 1024;
  35. gzip_proxied any;
  36. gzip_vary on;
  37. gzip_disable msie6;
  38. gzip_buffers 64 8k;
  39. gzip_types text/xml text/plain text/css application/javascript application/x-javascript application/rss+xml;
  40. # mod_http_proxy
  41. proxy_set_header Host $host;
  42. proxy_set_header X-Real-IP $remote_addr;
  43. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  44. proxy_redirect off;
  45. proxy_buffers 64 8k;
  46. proxy_connect_timeout 60;
  47. proxy_ignore_client_abort on;
  48. # fight DDoS attack, tune the numbers below according your application!!!
  49. #limit_req_zone $binary_remote_addr zone=req:20m rate=200r/s;
  50. #limit_req zone=req burst=100;
  51. #limit_zone conn $binary_remote_addr 20m;
  52. #limit_conn conn 200;
  53. server_names_hash_max_size 1024;
  54. server_names_hash_bucket_size 256;
  55. upstream adm {
  56. #server 10.26.27.190:9090 max_fails=2 fail_timeout=15s;
  57. #server 10.26.27.191:9090 max_fails=2 fail_timeout=15s;
  58. #server 10.26.27.192:9090 max_fails=2 fail_timeout=15s;
  59. #server 10.26.27.193:9090 max_fails=2 fail_timeout=15s;
  60. #server 10.26.27.194:9090 max_fails=2 fail_timeout=15s;
  61. #server 10.26.31.118:9090 max_fails=2 fail_timeout=15s weight=3;
  62. #server 10.26.31.119:9090 max_fails=2 fail_timeout=15s weight=3;
  63. #server 10.26.31.120:9090 max_fails=2 fail_timeout=15s weight=3;
  64. #server 10.26.31.121:9090 max_fails=2 fail_timeout=15s weight=3;
  65. #server 10.26.31.122:9090 max_fails=2 fail_timeout=15s weight=3;
  66. server 10.26.31.105:9090 max_fails=2 fail_timeout=15s weight=3;
  67. server 10.26.31.106:9090 max_fails=2 fail_timeout=15s weight=3;
  68. server 10.26.31.107:9090 max_fails=2 fail_timeout=15s weight=3;
  69. server 10.26.31.108:9090 max_fails=2 fail_timeout=15s weight=3;
  70. server 10.26.31.109:9090 max_fails=2 fail_timeout=15s weight=3;
  71. #server 10.26.31.110:9090 max_fails=2 fail_timeout=15s weight=3;
  72. }
  73. server
  74. {
  75. listen 80 default;
  76. server_name _;
  77. return 500;
  78. }
  79. server {
  80. listen 80;
  81. server_name adm.easou.com adm.appeasou.com;
  82. #charset koi8-r;
  83. access_log /data/ecom/nginx/logs/adm_access.log main;
  84. location / {
  85. root html;
  86. index index.html index.htm;
  87. proxy_next_upstream http_502 http_503 http_504 http_500 http_404 error timeout;
  88. proxy_pass http://adm;
  89. }
  90. #error_page 404 /404.html;
  91. # redirect server error pages to the static page /50x.html
  92. #
  93. error_page 500 502 503 504 /50x.html;
  94. location = /50x.html {
  95. root html;
  96. }
  97. location /nginx_status {
  98. stub_status on;
  99. access_log off;
  100. allow all;
  101. deny all;
  102. }
  103. }
  104. }