nginx.conf 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. user nginx nginx;
  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.31.105:9090 max_fails=2 fail_timeout=15s weight=3;
  57. server 10.26.31.106:9090 max_fails=2 fail_timeout=15s weight=3;
  58. server 10.26.31.107:9090 max_fails=2 fail_timeout=15s weight=3;
  59. server 10.26.31.108:9090 max_fails=2 fail_timeout=15s weight=3;
  60. server 10.26.31.109:9090 max_fails=2 fail_timeout=15s weight=3;
  61. }
  62. server
  63. {
  64. listen 80 default;
  65. server_name _;
  66. return 500;
  67. }
  68. server {
  69. listen 80;
  70. server_name adm.easou.com adm.appeasou.com;
  71. #charset koi8-r;
  72. access_log /data/ecom/nginx/logs/adm_access.log main;
  73. location / {
  74. root html;
  75. index index.html index.htm;
  76. proxy_next_upstream http_502 http_503 http_504 http_500 http_404 error timeout;
  77. proxy_pass http://adm;
  78. }
  79. #error_page 404 /404.html;
  80. # redirect server error pages to the static page /50x.html
  81. #
  82. error_page 500 502 503 504 /50x.html;
  83. location = /50x.html {
  84. root html;
  85. }
  86. location /nginx_status {
  87. stub_status on;
  88. access_log off;
  89. allow all;
  90. deny all;
  91. }
  92. }
  93. }