如何获得或拥有自己的IP地址?
我们运行的网站让人们注册自己的 URL 并重定向到我们的网站到他们的用户帐户。 Lets 它类似于 Blogspot.com,用户可以拥有自己的 URL。
问题是,为了做到这一点,我们需要有静态 IP 地址才能使 DNS 重定向发挥作用。我们可以轻松地从大多数托管公司获得静态 IP 地址,但如果我们更改托管公司,则意味着我们将不得不强制所有用户将其 DNS 设置更改为我们的新 IP 地址。这非常有问题。
有没有一种方法可以拥有我们自己的 IP 地址,以便我们可以将其带到我们决定去的任何托管公司?或者还有其他更简单的解决方案吗?
The website we running let people register their own URL and redirect to our website to their user account. Lets it is something similar to Blogspot.com where users can have their own URL.
The problem is that in order to do this we need to have static IP address for the DNS redirection to work. We can easily get static IP addresses from most hosting companies, but if we change our hosting company it means we will have to force all our users to change their DNS setting to our new IP address. This if very problematic.
Is there a way of owning our own IP address that we can take it with us to wherever hosting company we decide to go with? Or there there other easier solutions out there?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可以使用 DNS 来修复。创建一条 DNS“A”记录,将“your-site.com”指向您当前的 IP 地址。然后,当您的所有用户注册自己的 URL 时,他们不需要设置“A”记录,而是需要设置指向“your-site.com”的“CNAME”记录。如果您的 IP 将来发生变化,您只需更改“your-site.com”的“A”记录,然后所有其他 DNS 条目都会自动更新。
This can be fixed using DNS. Create a single DNS "A" record that points "your-site.com" to your current IP address. Then when all of your users register their own URL, instead of having them set up "A" records, they need to set up a "CNAME" record that points to "your-site.com". If your IP changes in the future, you just have to change the "A" record for "your-site.com" and then all of the other DNS entries will automatically be updated.
我永远不会创建 CNAME,这有点奇怪且不可扩展(还有一件事要做)...
只需在您的 A 记录中创建一个名为
*.yourdomain.com
的通配符,正常的做法是创建为此创建一个新域,例如
*.yourdomainaccount.com
并使用下面的示例,许多已知的 Web 服务都使用这种技术。然后在您的默认文件或 web.config 或站点配置的任何文件中,创建一个获取域的简单方法,例如服务器变量 SERVER_NAME
,然后将用户重定向到他们自己的帐户。
在 C# 中
I would never create CNAMEs, that's kinda weird and not scalable (one more thing to do)...
just create a wildcard in your A record called
*.yourdomain.com
the normal thing to do is create a new domain just for this, like
*.yourdomainaccount.com
and work the below example with that, plenty of known web services use this technique.then in your default file or web.config or whatever file is your site configuration, create a simple method that get's the domain, for example the Server Variable
SERVER_NAME
and then redirect the user to their own account.
in C#
这就是为什么域名是有用的抽象。只要域名注册到新地址,IP 就可以更改。对动态 DNS 进行一些研究。您会喜欢您所看到的。
http://www.dyndns.com/
This is why domain names are usefull abstractions. The IP can change as long as the domain is registered to the new address. Do some research about Dynamic DNS. You'll like what you'll see.
http://www.dyndns.com/