---
title: "nginx转nginx，域名无法获得"
author: "yangjayup"
date: "2015-09-25T17:13:22Z"
tags: []
categories: ["企业架构"]
slug: "nginx-nginx"
draft: false
lastmod: "2015-09-25T17:13:22Z"
id: 2246223
url: "https://yangjayup.iteye.com/blog/2246223"
---

nginx跳转到nginx的action，redirect时候域名取不到，直接是ip

解决办法，在第一个nginx配置：

    location / {  
#        proxy\_pass [http://dieoo.xicp.net:7167](http://dieoo.xicp.net:7167/);  
        proxy\_redirect off;  
        proxy\_set\_header Host $host;  
        proxy\_set\_header X-Real-IP $remote\_addr;  
        proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
        proxy\_pass [http://108.81.132.225:7128](http://108.81.132.225:7128/);  
        add\_header   Cache-Control no-cache;  
    }