Let's say the I have a web server running on port 3000, so example.com:3000 and another one on the 80, so: example.com

Is it possible to map example.com/map to example.com:3000 ?

I would like to map a directory to a different port of a different Apache installation, but I would like to hide the 3000 number.

Thanks.

link|improve this question

54% accept rate
feedback

4 Answers

up vote 1 down vote accepted
  1. you can use mod_proxy to match the URL and proxy the connection to port 3000
  2. If you do not require complete abstraction of port 3000, you can use mod_rewrite to match the URL and rewrite it to what the apache on port 3000 would serve.
link|improve this answer
feedback

Use an HTTP proxy that listens on port 3000. If you try to use the rewriter, it will force a client-side redirect, which will not be what you are after.

link|improve this answer
feedback

I know you can map virtual hosts to different ports using different sites like examlple1.com and example2.com - that's just in vhosts it's pretty easy.

Listen 80
Listen 8080

NameVirtualHost 172.20.30.40:80
NameVirtualHost 172.20.30.40:8080

<VirtualHost 172.20.30.40:80>
ServerName www.example1.com
DocumentRoot /www/domain-80
</VirtualHost>

<VirtualHost 172.20.30.40:8080>
ServerName www.example1.com
DocumentRoot /www/domain-8080
</VirtualHost>

<VirtualHost 172.20.30.40:80>
ServerName www.example2.org
DocumentRoot /www/otherdomain-80
</VirtualHost>

<VirtualHost 172.20.30.40:8080>
ServerName www.example2.org
DocumentRoot /www/otherdomain-8080
</VirtualHost>

But if you want to map a subdirectory to a different port I don't think you can do that without URL Rewriting on the backend so they didn't know it was happening - it wouldn't be very clean. You could do it relatively easily if you made it a subdomain like map.example.com

link|improve this answer
feedback

The simplest way I think is to have two VirtualHosts.

Listen 80
Listen 3000

<VirtualHost a.b.c.d:80>
DocumentRoot /html
</VirtualHost>

<VirtualHost a.b.c.d:3000>
DocumentRoot /html/map
</VirtualHost>
link|improve this answer
But I was talking about two different Apache servers in the same computer. – rtacconi Sep 7 '09 at 9:03
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.