Nginx上游为url

时间:2016-02-21 20:39:55

标签: linux nginx nginx-location

我正在尝试使用ur作为proxy_pass的域名如下:

set $full_uri "http://domian.com/resize$remote_uri";
proxy_pass $full_uri;

现在nginx正在发送域名IP的请求,并且无法通过IP访问,因此所有请求都会失败。

如何强制nginx向域本身发送请求而不是IP?

Nginx access_log:

109.xxx.xxx.xxx - JOR - [21/Feb/2016:19:59:27 +0000]  GET /1000x900/images/pic1.jpg HTTP/1.1 "504" 578 domain.com "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36" "109.xxx.xxx.xxx" upstream_response_time 30.001 upstream_addr xxx.xxx.xxx.xxx:80 msec 1456084767.428 request_time 30.002

由于

1 个答案:

答案 0 :(得分:1)

使用proxy_set_header。这应该足够了:

$cacheFactoryProvider