大网数据广告活动
服务器运维问答

Best way to change site IP address - from the end user perspective?

· 52CE 我爱测

I did read a bunch of relevant Q/A here but I am still not sure what the best answer is. I'm moving a couple of sites from IP address "1.a.b.c" to "2.d.e.f". As of right now in the existing DNS I set all TTL to 300 seconds, and I…

问题原文

原帖链接 · C C · CC BY-SA 3.0

I did read a bunch of relevant Q/A here but I am still not sure what the best answer is.

I'm moving a couple of sites from IP address "1.a.b.c" to "2.d.e.f". As of right now in the existing DNS I set all TTL to 300 seconds, and I have a new DNS zone ready to be used (on AWS Route 53), with new nameservers and all TTLs at 60 seconds. So I believe I am ready, from a DNS perspective. Post-move, after a few days I will set TTL to more reasonable numbers at Route 53.

I've warned all my users about the move and I have a defined window of time for the move. I told them that once the move is complete and if 24 hours have gone by and they still see the old (locked) sites, they should reboot their computer to force a local DNS cache flush.

I do not understand how the user's browser (cache) plays a role in this. My own experiments with a local hosts file (Win7) tell me there is something about the browser that is not letting the old IP address go -- I had to go to history->clear everything in order to get the new site location to show up, even after ipconfig /flushdns

(EDIT) - I do not have root access to the old server, so I can't implement the accepted answer to this question.

Question: I really don't want my users to have to deal with that, so is there something I can do to force all the browsers out there to re-cache? And if so, how long do I leave it turned on?

Thanks...

已采纳解答

原帖链接 · Yarik Dot · CC BY-SA 3.0

No, you can't. The problem is that DNS response can be cached anywhere between user and DNS server and there is no way to invalidate them.

What you can however do - as soon as you have data in sync and your second site is ready, you can reconfigure original server to behave as a proxy and pass all requests to the new location.

This way, you can achieve almost 0s of downtime of your website.

Update

If you don't have root access there are several options:

  • Perform proxying in PHP

  • Configure proxy on the second server (if you have root access there), switch DNS and when you are ready change proxy to webserver

  • This method can be source of problems Have 2 addresses (www.domain.tld and www2.domain.tld). Configure www2 (which is the same as www) and set correct DNS records. Then prepare www version of your site and do the switch of the DNS. Set redirect of all requests on old server to www2 subdomain.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-12-28)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。