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.
Simultaneous ServersYou can install Apache and IIS on the same Windows PC at the same time. Although the applications will run, they both listen for web requests on TCP port 80 — there will be clashes so a little configuration is required.
Select the website from the list in the main pane, then click “Bindings…” in the Actions panel on the right-hand side of the IIS Manager. This will bring up a dialog box showing which methods can be used to view the website and how. You'll want to select the one with “80” in the Port column, and then click Remove.
No; When you forward a port you send all traffic to a single address. If you need 2 devices to receive the data on the same port then you need to forward it to a single device that connects those 2 additional devices to the network ( say another router for instance ).
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With