nginx反向代理配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
http {
  proxy_cache_path  /data/nginx/cache  levels=1:2    keys_zone=STATIC:10m
                                       inactive=24h  max_size=1g;
  server {
    location / {
      proxy_pass http://x.x.x.x;
      proxy_set_header Host $host.proxydomainname.com;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_redirect $scheme://$host.proxydomainname.com/ /;
    }
    location ~* \.(swf|js|css|jpg|jpeg|png|txt|bmp|gif|ttf|woff|svg|eot|ico|html|htm|xhtml)$ {
      proxy_pass http://x.x.x.x;
      proxy_set_header Host $host.proxydomainname.com;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_redirect $scheme://$host.proxydomainname.com/ /;
      proxy_cache            STATIC;
      proxy_cache_key        $scheme$host$request_uri;
      proxy_cache_valid      200  30m;
      proxy_cache_use_stale  error timeout invalid_header updating http_500 http_502 http_503 http_504;
    }
  }
}

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload the CAPTCHA.

Proudly powered by WordPress   Premium Style Theme by www.gopiplus.com