views:

2290

answers:

9

I am running IIS and Apache HTTP Server side-by-side on my localhost machine, and Apache is listening on a different port (port 81). IIS is listening to port 80. However, I can only get to my virtual domains for Apache if I type in that port number. So for instance:

http://virtual.myvirtualdomain.com:81 http://virtual.myvirtualdomain2.com:81

How can I make it so Apache automatically knows it is port 81, and does not force me to type in the port number?

EDIT:

The answer appears to be that I need to redirect IIS to Apache. Can anyone provide clarification on how that is done with IIS 5.1?

+5  A: 

It's not a matter of telling Apache, it's a matter of the browser knowing what to connect to. You're either going to have to have IIS redirect to Apache, or give up.

Paul Tomblin
Can you see my edit?
hal10001
@hal10001 - Sorry, I know how to do it in Apache, not IIS.
Paul Tomblin
That's okay, thanks for the initial answer :)
hal10001
+2  A: 

You have to type in the port number so your client knows where to connect to. This has nothing to do with the server.

On Unix systems you might be able to modify your /etc/services to list 81 as port for http. But that would effectively disable access to all websites that are located on port 80.

Alternatively you can configure your IIS on port 80 to locally proxy requests for the sites which are on apache. Then all clients would ask the IIS for a page, which would make a local connection to port 81.

David Schmitt
I don't know of any browser that checks /etc/services.
Paul Tomblin
So much for portable runtimes with "native" implementations...
David Schmitt
Even if browsers did use /etc/services, it would only affect browsers running on that particular linux box, not people connecting to it from elsewhere.
Paul Tomblin
"does not force _me_ to type in the port number" ( see also http://stackoverflow.com/questions/164432/what-real-life-bad-habits-has-programming-given-you#164446 )
David Schmitt
+1  A: 

You can't. The 81 is telling your browser where to look for Apache.

Greg
+1  A: 

You can't.

It's the job of your web client to specify the port, and until you do specify that port it won't even reach Apache.

What you could potentially do is have IIS also listen for the same HTTP/1.1 virtual hosts, and then arrange for it to issue a 302 Moved redirect to send your browser to the right port number.

Alternatively, run a second IP address on your machine, and bind IIS to the original IP address and Apache to the second. That way you don't need to use different ports at all.

Alnitak
+1  A: 

There is no way to do exactly what you ask. About the only way would be to configure IIS -- for the virtual domains being served by IIS -- to forward to Apache on port 81. With this configuration, the client would not be aware that their requests were passing through IIS on their way to Apache. A little less efficient, but it would solve your needs.

Eddie
+2  A: 

I did some more research and it turns out that you can't redirect IIS 5.1 to Apache because that would require multiple Web sites (setup as redirects to the virtual hosts on Apache on port 81). This is because IIS 5.1 on Windows XP Pro can't do multiple Web sites (running at the same time without the scripting hack). Oh well.

hal10001
+2  A: 

How about you swap it? Make Apache listen on port 80, IIS on port 81 for whatever you need and have Apache redirect? Apache shouldn't be restricted to the same one-website per machine that IIS 5.1 is.

tonyriddle
+1  A: 

When an url is typed, there is a certain port that the browser has to use to connect to the site. 80 is the default port that the server checks. If you need to connect to any other port via a browser, you would need to have the port number in the url. It is not apache that is forcing you to type 81, but rather your browser because it is set to use 80 as the port when a port number is not specified.

If you were to change apache's port to 80 and IIS port to 81, then you be able to connect to apache without the port number but you will need to use the port number when using the IIS webserver.

Not sure what the others idea is behind using apache to redirect to IIS. It sounds like to me that if you make an entry in httpd.conf of apache for IIS directory, then you be using apache to connect to the directory, not IIS. You could set up a domain and have it connect to apache via port 81. That is one way to hide the port number (might be not true. I have never tried apache on port other than 80).

A: 

OK HERES ONE IM RUNNING 1 WEBSERVER ON 1 MACHINE AND ANOTHER WEBSERVER ON ANOTHER MACHINE, HOW DO I GET APACHE TO LOOK AT PORT 81? 2 DIDDERENT MACHINES 2 DIFFERENT OPERATING SYSTEMS AND 2 DIFFERENT WEB SERVER SOFTWARES

AnD Software