Apache and IIS side by side (both listening to port 80) on windows2003

前端 未结 9 1891
鱼传尺愫
鱼传尺愫 2020-12-04 09:15

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. Howeve

相关标签:
9条回答
  • 2020-12-04 10:04

    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.

    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.

    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)

    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...

    0 讨论(0)
  • 2020-12-04 10:07

    Installing Windows 10 I had this problem: apache(ipv4) and spooler service(ipv6) listening the same 80 port.

    I resolved editing apache httpd.conf file changing the line

    Listen 80

    to

    Listen 127.0.0.1:80

    0 讨论(0)
  • 2020-12-04 10:10

    I see this is quite an old post, but came across this looking for an answer for this problem. After reading some of the answers they seem very long winded, so after about 5 mins I managed to solve the problem very simply as follows:

    httpd.conf for Apache leave the listen port as 80 and 'Server Name' as FQDN/IP :80.

    Now for IIS go to Administrative Services > IIS Manager > 'Sites' in the Left hand nav drop down > in the right window select the top line (default web site) then bindings on the right.

    Now select http > edit and change to 81 and enter your local IP for the server/pc and in domain enter either your FQDN (www.domain.com) or external IP close.

    Restart both servers ensure your ports are open on both router and firewall, done.

    This sounds long winded but literally took 5 mins of playing about. works perfectly.

    System: Windows 8, IIS 8, Apache 2.2

    0 讨论(0)
提交回复
热议问题