Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

apache routing 1

Status
Not open for further replies.

quantumMoose

IS-IT--Management
Oct 4, 2002
8
NZ
Is it possible to set apache [or some other program] up as a router on a machine that processes the incomming requests on port 80 and redirects them around thet network based on the requested domain name. Eg, if I'm running a two webserver machines on one IP address, and i have all requests to xyz.com redirected to serverA, and requests to abc.com redirected to serverB.

ANY pointers apprecitated,

-Seamus
 
Hello,

Maybe forward port 80 request to another port on you second server using mod_rewrite and mod_proxy.

#apache httpd.conf

LoadModule rewrite_module libexec/httpd/mod_rewrite.so
...
LoadModule proxy_module libexec/httpd/libproxy.so
...
AddModule mod_proxy.c
...
AddModule mod_rewrite.c

Near the end of the httpd.conf, virtual host section:

<VirtualHost *:80>
RewriteEngine On
RewriteRule ^/(.*)$ [P]
</VirtualHost>

This simply takes every request on port 80 of and proxies it to

Regards
Blizz
 
I think this could be close to what I want, I dont fully understand the rewrite syntaxing (the doco is huge), but perhaps you could point me how to redirect to 127.0.0.2 if the domain contains freehost.com for example.
I think it could be like ^freehost.com/(.*) 127.0.0.1
however what are all the $ for?

-Seamus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top