Nginx反向代理+DNS轮询+IIS7.5 千万PV 百万IP 双线 网站架构案例

2019-10-17 21:11:20丽君

{
listen       192.168.0.1;
server_name  xxx.com;

access_log  /data/logs/dx.log  dx;

location /
     {
      proxy_next_upstream http_502 http_504 error timeout invalid_header;
     # proxy_cache cache_one;
     # proxy_cache_valid  200 304 12h;
     # proxy_cache_key $host$uri$is_args$args;
     proxy_set_header Host $http_host;
     #proxy_set_header X-Real-IP $remote_addr;
     # proxy_set_header X-Forwarded-For $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_headers_hash_max_size 51200;
      proxy_headers_hash_bucket_size 6400;

      proxy_pass http://dx;

      #if ($request_uri ~* "^/upload/") {
      #add_header Cache-Control 'max-age=86400';
      #}

      location ~* .(gif|jpg|jpeg|png|flv|swf|ico)$
      {
      proxy_set_header Host $http_host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_pass http://dx;
      add_header Cache-Control 'max-age=86400';
      }

      location ~* .(js)$
      {
      proxy_set_header Host $http_host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_pass http://dx;
      add_header Cache-Control 'max-age=600';
      }

      #expires      -1;
      add_header Cache-Control 'no-store, no-cache, must-revalidate';
      add_header Pragma no-cache;
      }

  location ~ /purge(/.*)
    {
     allow            127.0.0.1;
     allow            192.168.0.0/16;
     deny            all;
     #proxy_cache_purge    cache_one   $host$1$is_args$args;
    }

    location ~ .*.(php|jsp|cgi|asp|aspx|flv|swf|xml)?$