windows2003上的Apache和IIS并排(都侦听端口80) [英] Apache and IIS side by side (both listening to port 80) on windows2003

查看:25
本文介绍了windows2003上的Apache和IIS并排(都侦听端口80)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么好的方法可以做到这一点?甚至有可能做到干净吗?

What are some good ways to do this? Is it even possible to do cleanly?

理想情况下,我想使用数据包头来决定哪个服务器应该处理请求.但是,如果有更简单/更好的方法,请告诉我.

Ideally I'd like to use packet headers to decide which server should handle requests. However, if there is an easier/better way let me know.

推荐答案

不可能让两台服务器在同一个 IP 地址上监听同一个端口:由于单个套接字只能被单个进程打开,因此只有第一个为某个 IP/端口组合配置的服务器将成功绑定,第二个将失败.

It's impossible for both servers to listen on the same port at the same IP address: since a single socket can only be opened by a single process, only the first server configured for a certain IP/port combination will successfully bind, and the second one will fail.

因此,您需要一种解决方法来实现您想要的.最简单的可能是在您的主要 IP/端口组合上运行 Apache,并使用 mod_rewrite.

You will thus need a workaround to achieve what you want. Easiest is probably to run Apache on your primary IP/port combination, and have it route requests for IIS (which should be configured for a different IP and/or port) to it using mod_rewrite.

请记住,连接到您的服务器的客户端应该可以访问 IIS 运行的备用 IP 和端口:如果您只有一个可用的 IP 地址,则应注意选择一个通常不可用的 IIS 端口被防火墙阻止(8080 可能是一个不错的选择,或者 443,即使您运行的是常规 HTTP 而不是 SSL)

Keep in mind that the alternative IP and port IIS runs on should be reachable to the clients connecting to your server: if you only have a single IP address available, you should take care to pick an IIS port that isn't generally blocked by firewalls (8080 might be a good option, or 443, even though you're running regular HTTP and not SSL)

附言另外,请注意,您确实需要使用 httpcfg 修改 IIS 默认配置,然后才能允许其他服务器在同一服务器上的任何 IP 地址上的端口 80 上运行:请参阅 Micky McQuade 的回答以了解执行此操作的过程...

P.S. Also, please note that you do need to modify the IIS default configuration using httpcfg before it will allow other servers to run on port 80 on any IP address on the same server: see Micky McQuade's answer for the procedure to do that...

这篇关于windows2003上的Apache和IIS并排(都侦听端口80)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆