Apache and IIS side by side (both listening to por

2019-01-16 05:10发布

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.

9条回答
仙女界的扛把子
2楼-- · 2019-01-16 05:53

That's not quite true. E.g. for HTTP Windows supports URL based port sharing, allowing multiple processes to use the same IP address and Port.

查看更多
不美不萌又怎样
3楼-- · 2019-01-16 05:54

You will need to use different IP addresses. The server, whether Apache or IIS, grabs the traffic based on the IP and Port, which ever they are bound to listen to. Once it starts listening, then it uses the headers, such as the server name to filter and determine what site is being accessed. You can't do it will simply changing the server name in the request

查看更多
等我变得足够好
4楼-- · 2019-01-16 05:56

I found the following link which suggested to have two separate IP addresses so that both could listen on port 80: (Edit: Link no longer works: www.prismix.com/blog/2006/06/running_apache_and_iis_6_toget.cfm)

There was a caveat that you had to make a change in IIS because of socket pooling. Here are the instructions based on the link above:

  1. Extract the httpcfg.exe utility from the support tools area on the Win2003 CD.
  2. stop all IIS services: net stop http /y
  3. have IIS listen only on the IP address I'd designated for IIS: httpcfg set iplisten -i 192.168.1.253
  4. make sure: httpcfg query iplisten (the ip's listed are the only ip addresses that IIS will be listening on and no other)
  5. restart IIS Services: net start w3svc
  6. start Apache service
查看更多
趁早两清
5楼-- · 2019-01-16 06:05

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

查看更多
一夜七次
6楼-- · 2019-01-16 06:06

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

查看更多
够拽才男人
7楼-- · 2019-01-16 06:08

You need at least mod_proxy and mod_proxy_http which both are part of the distribution (yet not everytime built automatically). Then you can look here: http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Simplest config in a virtualhost context is:

ProxyPass         /winapp http://127.0.0.1:8080/somedir/

ProxyPassReverse  /winapp http://127.0.0.1:8080/somedir/

(Depending on your webapp, the actual config might become more sophisticated. ) That transparently redirects every request on the path winapp/ to the windows server and transfers the resulting output back to the client.

Attention: Take care of the links in the delivered pages: they aren't rewritten, so you can save yourself lotsa hassle if you generally use relative links in your app, like

<a href=../pics/mypic.jpg">

instead of the usual integration nightmare of every link being absolute:

<a href="http://myinternalhostname/somedir/crappydesign.jpg">

THE LATTER IS BAD ALMOST EVERY SINGLE TIME!

For rewriting links in pages there's mod_proxy_html (not to confuse with mod_proxy_http!) but that's another story and a cruel one as well.

查看更多
登录 后发表回答