Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

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.
share|improve this answer
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
    
This is the correct answer –  dukeofgaming Aug 17 '12 at 18:42
add comment

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>
share|improve this answer
    
But I was talking about two different Apache servers in the same computer. –  rtacconi Sep 7 '09 at 9:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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