Welcome to WebmasterWorld Guest from 54.242.134.77

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Routing to multiple physical webservers

multiple servers

     

serutan

8:58 am on Apr 16, 2006 (gmt 0)

10+ Year Member



Suppose I have 2 computers named mars and venus on my network, both with web servers on them. How can I present them to the outside world as mars.mydomain.com and venus.mydomain.com? I only have one external IP address.

So far I have tried setting up NAT with port addressing on my router, so one machine is www.mydomain.com and the other is www.mydomain.com:8000, but that's confusing to ordinary users.

I also tried pointing all port 80 traffic to mars, and in mars's httpd.conf redirecting venus.mydomain.com to venus by internal IP address, but then the user sees that internal IP in the URL and cannot bookmark it.

Don't lots of geeks with multiple computers do this same thing? Do you have to set up one machine as a DNS server or something? Having skimmed the DNS docs, I hesitate to delve into DNS unless it's really the right thing.

uncle_bob

10:18 am on Apr 16, 2006 (gmt 0)

10+ Year Member



If you want them both to run from port 80, which is much less confusing to users, then look into setting up a "reverse proxy" , which will forward requests to either mars or venus depending on the url.

Common reverse proxies for windows/linux are "Microsoft Proxy Server" (or whatever it's now called), Apache's mod_proxy, and squid.

zCat

10:21 am on Apr 16, 2006 (gmt 0)

10+ Year Member



I use a combination of mod_proxy and mod_rewrite on the Apache connected to the external IP to transparently redirect traffic to servers listening on internal addresses.

serutan

6:51 pm on Apr 17, 2006 (gmt 0)

10+ Year Member



Thanks for the quick answers! I checked out mod_rewrite and mod_proxy. As a test, I tried to route a subdirectory from my mars server to my venus server, but there is some kind of access problem.

On my Mars machine, which is the port 80 server to the outside world, I enabled mod_proxy. Then at the bottom of the VirtualHost block for mysite.com I put the following two lines:

ProxyPass /test/ http://venus/test/
ProxyPassReverse /test/ http://venus/test/

Requests to http://www.example.com/test should now be routed to http://venus/test. But what happens is I get a Forbidden error on the browser. It looks like the server on mars is trying to pass the request, because browsing to a nonexistent location like http://www.example.com/bogus gives a Not Found error instead. I can browse to http://venus/test directly with no error. What is getting in the way?

[edited by: jdMorgan at 1:15 pm (utc) on April 18, 2006]
[edit reason] example.com, de-linked. [/edit]

serutan

5:49 am on Apr 18, 2006 (gmt 0)

10+ Year Member



Ok, the missing piece was that it is necessary to allow proxy. By default proxy is denied. I commented out the Deny and added an Allow for my specific virtual host in proxy.conf:

<Proxy *>
Order deny,allow
Allow from .myvirtualhost.com
#Deny from all
</Proxy>

The <VirtualHost> block for that host contains these lines:

ProxyPass /test/ http://venus/test/
ProxyPassReverse /test/ http://venus/test/

With these settings, requests for the /test folder on my outside-facing web server (mars) are transparently routed to the venus web server.

I still want to work out how to combine mod_rewrite and mod_proxy to route an url like http://xyz.example.com to http://otherserver/xyz, but in the meantime this will work fine.

[edited by: jdMorgan at 1:16 pm (utc) on April 18, 2006]
[edit reason] example.com, de-linked. [/edit]

jdMorgan

1:14 pm on Apr 18, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I still want to work out how to combine mod_rewrite and mod_proxy to route an url like http://xyz.example.com to http://otherserver/xyz, but in the meantime this will work fine.

This search [google.com] should get you going on that subject.

Jim

 

Featured Threads

Hot Threads This Week

Hot Threads This Month