我正在使用 AWS Elasticache 服务器example.foo.euw1.cache.amazonaws.com我希望 nginx 能够在位置指令中使用它(这只是一个简单的例子):
location /cached {
set $memcached_key $uri;
memcached_pass example.foo.euw1.cache.amazonaws.com:11211;
try_files $uri =404;
}
Run Code Online (Sandbox Code Playgroud)
因为 Elasticache 节点 IP 地址可以更改,所以我不想使用 example.foo.euw1.cache.amazonaws.com 的当前 IP 地址。
我resolver应该使用什么IP 来获取 AWS 内部 IP 地址 (10.x) 而不是面向公众的版本 (79.x)?
在运行 nginx 的机器上,我可以通过以下host调用来模拟:
$ host example.foo.euw1.cache.amazonaws.com
$ 10.120.40.80
$ # ^^^ that's the correct internal address I want to use
$
$ host example.foo.euw1.cache.amazonaws.com 8.8.4.4
$ 79.125.100.150
$ # ^^^ that's the public IP that I don't want …Run Code Online (Sandbox Code Playgroud)