Mobile app version of vmapp.org
Login or Join
Yeniel560

: Apache HTTP Server Configuration on Port Other Than :80 I am running an apache server for development on windows 7 (via XAMPP). By default, it is set up to listen on port :80 for http://

@Yeniel560

Posted in: #Apache #HttpdConf #Xampp

I am running an apache server for development on windows 7 (via XAMPP).

By default, it is set up to listen on port :80 for requests.

I can configure it for, say, port :1234, and can access web documents via: localhost:1234/ just fine.

My question is this - Is is possible to have apache serve on port :1234 but NOT have to include :1234 in the URI for the request?

EDIT/CLARIFICATION:
What I am really trying to do is run IIS (on port 80) and apache (xampp) at the same time, without having to add a port number to the browser request for one of them.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Yeniel560

2 Comments

Sorted by latest first Latest Oldest Best

 

@Angela700

When you type an URL in a browser, unless you specify the port explicitly, the browser will assume port 80 (unless the path is HTTPS, in which case port 443 is assumed). Technically any URL can be rewritten to include :80 port directive. It is just redundant.

On the server side there can only be one service listening at port 80. So, no, you can not have both IIS and Apache accepting connections without one of the using another port than 80.

The solution...

What is typically done in this situation is for one webserver or the other (usually Apache since this is simple to configure in it) is set up on port 80 and it is responsible for acting as a front end for the other server. I.e. it passes certain requests (based on hostname, path or some other configuration) on to the other server.

I do this extensively where Apache serves as a front-end and directs requests to multiple Tomcat servers.

The Apache configuration you use for this is called "ProxyPass" and, as the name suggests, Apache is simply acting as an intermediary and passing the traffic on to another server for those VirtualHosts or Locations that are specified. For other hosts or paths Apache can still serve its own content directly.

More info here: httpd.apache.org/docs/2.2/mod/mod_proxy.html

10% popularity Vote Up Vote Down


 

@Speyer207

Sadly it is not possible since this is controlled by the browsers. By default browsers will connect to port 80 and anything else needs to be added in the URL.

There is 3 solutions I can think of what could work but ultimately it will not work for public users since some coding on the clients machines would need to be changed.

Host File Method

You could change the host file and resolve the localhost or domain name with the port. But again this wouldn't for public visitors.

Browser Edit

You could make a plugin to override the default of checking port 80 and add an additional check of port 1234. I'd imagine a plugin for Firefox and chrome like this may exist already or it would be easy to code.

Redirect

You could run the server on both ports 80 and 1234, you could then direct from 80 to 1234. Again this is because the browser checks for port 80. It doesn't check any other ports especially as high as 1234. I believe the htaccess file would do this for you.

XAMP to LAMP

Rather than using XAMP you want to use a real lamp within a virtual environment using virtual-box or vwplayer. By doing so you will receive another ip therefore you can simply run both apache and iis on port 80.

BUT I WANT XAMP

Lamp is so much better than xamp but if you still want to use it then you can run both on port 80 by adding a virtual network card in Windows (called a loop-back) you will need to tell xamp and iis what ips to bind to. For more info go to:http://support.microsoft.com/kb/839013

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme