我可以通过 1 个 IP 地址在 LAN 上托管两个独立的 Web 服务器吗?

发布于 2024-07-11 18:50:25 字数 634 浏览 6 评论 0原文

我是一名网络程序员,从事家庭网络开发工作。 我家里有多个通过 FIOS 连接的 Web 服务器。 我有自己的域通过 dyndns.org 的自定义域服务指向我的路由器。

我的 ISP 为我提供了一个静态 IP 地址,目前允许我将路由器配置为通过端口 80 引导一台服务器的出站 Web 流量,通过端口 8080 引导另一台服务器的出站 Web 流量。这很糟糕,因为现在许多公司阻止端口 8080,导致一些我的公司客户无法访问我的第二个网络服务器。

有没有办法让我使用两个单独的主机名将常规旧端口 80 Web 流量定向到网络内部的两个单独的 Web 服务器?

例如。 我希望 http://webserver1.mydomain.com 访问网络上的一台 Web 服务器,并 http://webserver2.mydomain.com 访问另一台 Web 服务器,两组流量均在端口 80 上提供服务。

这可能吗? 如果没有,我可以通过编程方式将流量从一个 Web 服务器透明地路由到另一个 Web 服务器来进行黑客攻击吗?

根据记录,我运行 MS Windows Server 2008 IIS 7.0 堆栈、D-link DIR-655 路由器,并使用 DynDNS 来满足我的域需求。

I am a web programmer with a home web dev operation. I have multiple web servers in my house on a FIOS connection. I have my own domain pointed to my router through dyndns.org's custom domain service.

My ISP gives me ONE static IP address, which at the moment allows me to configure my router to direct outbound web traffic from one server through port 80 and another server through port 8080. This sucks because many companies block port 8080 these days causing some of my corporate clients to not be able to hit my second web server.

Is there any way for me to direct regular old port 80 web traffic to TWO SEPARATE web servers internally on my network using two separate host names?

For instance. I want http://webserver1.mydomain.com to hit one web server on my network, and http://webserver2.mydomain.com to hit another web server and have both sets of traffic served on port 80.

Is this even possible? If not, can I do a hack by programmatically routing traffic from one web server transparently to another?

For the record I run MS Windows Server 2008 IIS 7.0 stack, a D-link DIR-655 router, and use DynDNS for my domain needs.

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

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

发布评论

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

评论(6

兮颜 2024-07-18 18:50:25

您正在寻找的解决方案的名称称为反向代理。
apache 中有实现,squidMircosoft ISA 服务器

如果你喜欢冒险,你总是可以自己动手吗? 或修改诸如之类的内容来满足您的需求。

我有客户使用鱿鱼反向代理,容量很大,而且运行完美!

不过,它确实会搞乱网络服务器上的网络日志,流量似乎都来自正在进行重定向/重写的内部代理主机。

The name of the solution you looking for is called reverse proxy'ing.
There are implementations in apache, squid and Mircosoft ISA Server.

If your adventurous you can always roll your own? or modify something like this to meet your your needs.

I've had customers using squid reverse proxy that's high volume and it works perfectly!

It does tend to screw up your web logs on the webserver though, traffic will all appear to come from your internal proxy host that's doing the redirection/rewriting.

看轻我的陪伴 2024-07-18 18:50:25

是的,使用IIS7的Rewrite模块来做到这一点

Yes, use IIS7's Rewrite module to do this

雪落纷纷 2024-07-18 18:50:25

您可以选择某种应用程序层路由。 本文介绍了如何在 ISA 服务器上执行此操作(使用 Web 规则)

http:// www.codinghorror.com/blog/archives/000984.html

Some sort of application layer routing could be your option. This article points to how to do it on ISA server (using web rules)

http://www.codinghorror.com/blog/archives/000984.html

凡间太子 2024-07-18 18:50:25

您也许可以使用 2 个虚拟主机设置 apache,然后在每个块中放置本地网络上相应站点的代理:

在虚拟主机 1 中:

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass / http://192.168.0.49/
ProxyPassReverse / http://192.168.0.49/

在虚拟主机 2 中:

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass / http://192.168.0.50/
ProxyPassReverse / http://192.168.0.50/

您需要 mod_proxy,我什至不确定这是否有效

You might be able to set up apache with 2 vhosts, and then in each of their blocks put a proxy of the appropriate site on your local network:

In vhost 1:

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass / http://192.168.0.49/
ProxyPassReverse / http://192.168.0.49/

In vhost 2:

ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass / http://192.168.0.50/
ProxyPassReverse / http://192.168.0.50/

You'd need mod_proxy, and I'm not even sure this would work

终陌 2024-07-18 18:50:25

为什么不简单一点,直接在您的帐户上订购或请求第二个 IP 地址呢? 这似乎是比复杂的硬件和/或软件设置更容易的解决方案。 只是不要告诉他们您正在托管网站,因为 ISP 通常不喜欢人们在住宅帐户上这样做(实际上我很惊讶他们没有阻止端口 80)。

Why not keep it simple and just order or request a second IP address on your account? This seems to be a much easier solution than a convoluted hardware and/or software setup. Just don't tell them you're hosting websites because ISPs generally don't like people to do that on residential accounts (I'm actually surprised they don't block port 80).

一个人的旅程 2024-07-18 18:50:25

这是一篇旧帖子,但我也有同样的问题。 Verizon 只给你 1 个 ip。 如果你想要更多,你必须使用他们的商业计划,每月大约 100 美元。
我有一个正在运行的 redhat 和 windows 2008r2 家庭服务器。 我有 2 个 godaddy 域名都指向我的 verizon wan IP 地址。 我的 Windows 服务器对 mysite1.com 使用端口 80,对 mysite2.com 使用端口 8080。 我不使用 DYN 因为我想使用我自己的域名。 我制作了一个 IIS 站点主机头,将 mysite2.com 定向到我的 Linux 机器。 这两个域都在线工作,但在浏览器 URL 窗口中输入 mysite2.com 会定向到 mysite2.com:8080。 我认为没有办法隐藏 8080。至少没有正确隐藏。 我在政府机构工作,他们阻止使用端口 8080 的站点。他们还阻止使用屏蔽/帧转发的域。 因此屏蔽 8080 会导致您的网站被屏蔽。 最好的解决方案是 Verizon 以合理的价格向我们这样的人提供 2 个 IP 地址!

This is an old post but I have the same problem. Verizon only gives you 1 ip. If you want more you have to use their business plan for about $100 a month.
I have a redhat and windows 2008r2 home server running. I have 2 godaddy domain names both pointing to my verizon wan ip address. My windows server is using port 80 for mysite1.com and my linux port 8080 for mysite2.com. I dont use DYN because I want to use my own domain names. I made an IIS site hostheader to direct mysite2.com to my linux box. Both domains work online but typing in mysite2.com directs to mysite2.com:8080 in the browser url window. I dont think there is a way to hide 8080. At least not correctly. I work at a government agency and they block sites that use port 8080. They also block domains that are forwarded with masking/frame. So masking 8080 will cause your site to be blocked. The best solution is for Verizon to offer 2 ip address for a reasonable price to people like us!

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