---
title: "Nginx+Oracle Web Cache"
author: "sslaowan"
date: "2012-06-30T21:11:38Z"
tags: []
categories: ["企业架构"]
slug: "nginx-oracle-web-cache"
draft: false
lastmod: "2012-06-30T21:12:33Z"
id: 1572225
url: "https://sslaowan.iteye.com/blog/1572225"
---

Oracle Web Cache设置为Cluster，然后我们通过一个地址去访问它，如果前面加了个Nginx，则需要将Server这样写：

 

```
upstream wc_server{
   server wc.yourdomain.com:8785;
 
}

  

 server {
      listen 8045;
      server_name frontserver8045;


      location /{
        proxy_redirect wc.yourdomain.com:8785  /;          
      
        proxy_set_header Host wc.yourdomain.com:8785; 
     
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_pass http://wc_server;
```

  重点是要把host设置为web cache那个服务器的host，并且通过proxy\_redirect替换web cache 的host为nginx（只写个/表示替换本机）

 

 

    如果前面Ngnix前面再有个四层负载均衡器，它也有个自己的host，比如叫4-layer-lb.yourdomain.com，那么需要将proxy\_redirect这样写：

    proxy\_redirect http://wc.yourdomain.com:8785/ http://4-layer-lb.yourdomain.com/;