清漆+ Nginx + ELB 499响应 [英] Varnish + nginx + ELB 499 responses

查看:102
本文介绍了清漆+ Nginx + ELB 499响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我让varnish 4服务器使用nginx作为连接到ELB的反向代理.

I am having varnish 4 server working with nginx as reverse proxy connected to ELB.

每隔两天左右,我的服务器就会停止响应,并且我在nginx access.log中看到499个响应

Every 2 days or so my server is stop responding and I see 499 responses in nginx access.log

重新启动nginx可以解决问题.

restarting nginx is solving the problem.

为什么我开始收到这499条回复?

Why am I started to get these 499 responses?

为什么要重启nginx来解决问题?

Why restarting nginx solving the issue?

推荐答案

我在了解了两个事实之后解决了我的问题:

I solved my issue after understanding two facts:

1)ELB实例具有动态DNS名称

1) ELB instance has dynamic DNS name

2)nginx仅在重新加载/重新启动时解析DNS名称

2) nginx resolve DNS names only on reload/restart

问题是ELB更改了其IP地址,而nginx保留了旧的IP地址.

The problem was that the ELB changed its IP address and nginx kept the old IP address.

解决方案是在nginx.conf中使用解析器.这是我的nginx.conf:

The solution is to use resolver in nginx.conf. Here is my nginx.conf:

http {  

    resolver x.x.x.x valid=30s;

}

server {

    set $elb "example.com";

    location / { 

        proxy_pass http://$elb; 

        }
}  

解析器IP地址应该是DNS服务器,例如/etc/resolv.conf.

The resolver IP address should be a DNS server such in /etc/resolv.conf.

这篇关于清漆+ Nginx + ELB 499响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆