DNS-将子文件夹的 DNS 路由到不同的服务器?

发布于 2024-07-06 15:32:53 字数 185 浏览 11 评论 0原文

假设我想要一个名为 - http://www.foo.com/news/ 的子文件夹但我实际上希望该新闻文件夹位于不同的服务器上。 我意识到可以使用子域轻松完成此操作,但我真的希望子文件夹的事情。

是否可以? 如何?

LEt's say I want to have a subfolder called- http://www.foo.com/news/ but I actually want that news folder on a different server. I realize it can be done easily with subdomains, but I was really hoping for the subfolder thing.

Is it possible? How?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

扶醉桌前 2024-07-13 15:32:53

唯一真正的方法是在您和知道每个文件夹所在 IP 地址的外界之间使用反向代理(或充当反向代理的网络服务器)不可能

只做一些事情,例如让 google.com 出现在 http://foobar.com/google/< /a> 因为浏览器不会路由到该 IP 地址(缺少信息)。

您可以使用全页 IFrame 或其他框架集系统来伪造这种效果,但这是相当危险的。

如果您使用 apache,则可以使用 mod_proxy 进行设置。 更多详细信息可以在这里找到:

The only real way to it is with a reverse proxy ( Or a webserver acting as a reverse proxy ) between you and the outside world that knows what IP address each folder is in.

Its not possible to just make something, for example have google.com appear at http://foobar.com/google/ because the browser won't route to the IP address ( lack of information ).

You can fake that effect with a fullpage IFrame or Other frameset system, but that's rather dodgy.

If you are using apache, you can set this up with mod_proxy. More details can be found here:

时光病人 2024-07-13 15:32:53

对于 Apache,需要 httpd.conf 中的以下条目:

LoadModule proxy_module module/mod_proxy.so
LoadModule proxy_http_module module/mod_proxy_http.so

ProxyPass /news http://newsserver.domain.com/news< br>
ProxyPassreverse / http://newsserver.domain.com/

For Apache the following entries in httpd.conf are needed:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

ProxyPass /news http://newsserver.domain.com/news
ProxyPassreverse / http://newsserver.domain.com/

九局 2024-07-13 15:32:53

是的,IIS 中有一个设置可以让您将子文件夹指向不同的站点。 因此,将子文件夹设为站点上的虚拟目录,然后在虚拟目录的属性中选择“重定向到 URL”选项...在其中指定您的其他站点。

当然,这是假设您使用的是 IIS。 无论您使用什么网络服务器,都应该有类似的东西可以使用。

Yes, there is a setting in IIS which lets you point a subfolder to a different site. So make the sub folder a virtual directory on your site, and then in the properties of the virtual directory choose the option for 'A redirection to a URL'... in it specify your other site.

Of course, this is assuming your are using IIS. There should be something similar available to use in whatever web server you are using.

萧瑟寒风 2024-07-13 15:32:53

不能用DNS来完成,因为域名只是地址的*.example.com。

可以通过在 www 计算机上配置代理来将 /news 的所有请求传递到另一台服务器来完成。 使用 apache 很容易做到,但我现在不记得所有细节了。

It can't be done with DNS because the domain name is only the *.example.com of the address.

It can be done by configuring a proxy on your www machine to pass all requests for /news to another server. It's very easy to do with apache but I don't remember all the details at this moment.

冷情 2024-07-13 15:32:53

DNS 解析发生在域级别。 DNS 不了解 URL 或文件夹,因此您的名称将始终指向同一服务器。 您可以使该服务器实际上从另一台服务器检索信息或重定向到另一台服务器,但我想说这并不是很令人满意。

DNS resolution happens at the domain level. DNS doesn't have any knowledge of URLs or folders so your name will always point to the same server. You can make that server actually retrieve the information from another one or redirect to another one but that's not very satisfactory I'd say.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文