2018年3月

nginx反向代理的dns更新(504 Gateway Time-out)

网站隔三差五的就挂掉,一直以为是球猫在搞鬼,这不,又挂掉了504 Gateway Time-out,本以为是bug已经升级了nginx的,问题依旧。
几次尝试解决,都以失败告终,只能发现后sudo nginx -s reload,总不能放到定时任务中吧,再次查看日志sudo cat /var/log/nginx/error.log。

upstream timed out (110: Connection timed out) while connecting to upstream, upstream: "http://123.123.12.3", host: "mikuq.com"

尝试浏览器中访问这个IP,访问不到,奇怪了,再次确认竟然是过期的IP,参考了几篇文章,是通病,尝试解决,查询本机的dns,写到配置文件中cat /etc/resolv.conf,重起,过几天看效果吧。

参考文献:
https://serverfault.com/questions/240476/how-to-force-nginx-to-resolve-dns-of-a-dynamic-hostname-everytime-when-doing-p
https://www.zhihu.com/question/61786355