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.

Our home setup consists of two Linux webservers on a single static IP. My server currently uses the standard HTTP(S) ports. My friend's server uses non-standard ports to get around this. Both of us have URLs set up.
I'm curious as to whether I could configure Apache on my server to redirect or proxy any connections heading to my friend's URL (on standard ports), to his server, transparently. I know I could rewrite the URLs but I'm not good with the rules, so I'm wondering if I could use mod_proxy to send the connection to the other machine through my server. I've done something similar, but that involved proxying all incoming connections.
Is it possible? Thanks, and sorry if this has been answered; I wasn't sure what to search for.

share|improve this question
add comment

1 Answer 1

You could also do this using virtual hosts and setup Apache as a reverse proxy. This is how I have it setup where I work.

a.domain.com -> ProxyPass http://192.168.1.101
b.domain.com -> ProxyPass http://192.168.1.102

Checkout the documentation for ProxyPass and ProxyPassReverse.

If you just do a name based virtual host for both then you could add something like this to your virtual host definition (or replace localhost for your IP if your box will be hosting apache):

<Location />
    ProxyPass http://192.168.1.101
    ProxyPassReverse http://192.168.1.101
</Location>

Then in your friend's virtual host config

<Location />
    ProxyPass http://192.168.1.102
    ProxyPassReverse http://192.168.1.102
</Location>

You can also add ports to the ProxyPass directive if you don't want your friend to change firewall rules, service setting etc. Or you can even be a reverse proxy for another external IP address too.

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