HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   Multiple Physical Hosting Servers Sharing IP (http://www.howtoforge.com/forums/showthread.php?t=7741)

wyzzkid 27th October 2006 20:40

Multiple Physical Hosting Servers Sharing IP
 
Hi,

Like most people I will apologise in advance if this is in the wrong forum; I have spent weeks reading thru all the how-to's (brilliantly written, and most educational,) trying things out, and reading thru the fora (also educational,) so I am reasonably confident no one asked this before,:rolleyes:
I am also reasonably confident that there are a few peeps that would like to do this, and when I get this all figured out and working, with your help, I will happily package it up into a giant how-to for your posting pleasure :)
so here goes...

I have 3 questions semi-related, so I will ask together;

background:

Like many, I am behind a NAT router that gets one dynamic IP (eventually this setup will move to a location with a real static IP); there are three physical hosts on the inside, each running their own webservers, etc; there are several domains at dyndns.org so that they all point here; if there is only one physical host, with ISPConfig, everything makes sense; but now I don't how to make the select domain go the right physical host;

considerations, and things I have tried (at least partially):
ˇI dont want to use non-standard port numbers, for forwarding;
ˇpretty sure that each machine needs its own ISPConfig to administer the vhosts on that machine
ˇmultiple routers to separate private networks
ˇif it makes anything inherantly easier, using 10.x.y.z, or any other private pool set, that is ok too
ˇconsidering using xen to help with all this
ˇseparate nameserver on inside on one of the physical hosts to make sure everything coming in works

so, more specifially, the router has dhcp 192.168.1.x /24 for windows computers for the kids, with pool from .100 to .200;
each physical host is statically assigned an IP 192.168.1.20, 192.168.1.30 and 192.168.1.40 (and that machine can `admisiter`10 IPS internally to `assign` an IP to the vhost)

the below assumes that example.com is a real reg'd domain; and that example.myphotos.cc and example.mine.nu are free services from dyndns.org

host1: kids.example.com 192.168.1.20 hosts each kid's own domain from a dyndns.org pool, hence: kid1.example.myphotos.cc, kid2.example.myphotos.cc, or kid1.example.mine.nu, etc) the dns records at dyndns have the wildcard set, so any host at example.myphotos.cc (/etc/interfaces listens on .20 to .29, so that each kid may later have his/her own IP)

host2: testing.example.com 192.168.1.30 hosts real domains while they are being built and tested, until they such time as they are moved to the real permanent host - considering xen for this purpose, so that each real test is in its own space, in which case each DomU will get one IP .31, .32 etc

host3: another.example.com 192.168.1.40 will host the real domains, (soon to be moved to a different location with a static IP)

so the question is,,, can it be done? (of course, but..)
the BIG question is,,, can it be done EASILY :D ? and can anyone help

QUESTION 1: how do I get each domain coming in thru the router to go the correct physical host :confused: ? can one nameserver administer all this ? and can one of the others be a backup nameserver?
with ISPConfig on each host, they all are running BIND, so one of them can be the nameserver to direct all incoming requests (port fwd from router?) to the appropriate phys host, but I dont know to set that up properly

QUESTION 2: when I was trying things out with ISPConfig, and using the co-domains and forwarding, I could not achieve the goal I wanted; the plan for any given site, example.com is to have directories inside of .../web that can be used as whatever.site.com, and have it show up in the address bar that way; hence: for a system the first vhost's web folder is at /var/www/web1/web (I see that ISPConfig puts in symlinks for the co-domains forwarding), so that hosted site was ex1.com, if I have web/index.html and web/forum/index.php, and web/test/index.php, I want to be able to use ex1.com (or www.ex1.com), and test.ex1.com and forum.ex1.com, but so far no matter how I do this, although it accepts and delivers the page, the address bar shows: www.ex1.com/test/;
similar for users of the domain, can user show up as user.ex1.com instead of www.ex1.com/~user ?

QUESTION 3: when all this is done, (hopefully soon with your help, and I finally get to move it to a static location, the guy there said I could use his nameserver as my secondary, and I only had to run one, since I will only have one static IP from his block; how do I get my nameserver to pass its zone info to his, or need he do something to his for this to happen?

I hope the verbose post makes it clear;

djtremors 28th October 2006 05:10

I haven't read your full post as I'm in a rush to search something before I got out onsite.. but this may be what you want after a glance through your issue.


Just create a VirtualHost (Or ISPC website) for each of the domains you want and using NameVirtualHost would match each by the requested hostname ( www.yourdomain.com)

In the HTTPD Includes add the following for each and change the IP as such.
PHP Code:

ProxyRequests Off
ProxyPass 
http://192.168.1.20:80/
ProxyPassReverse http://192.168.1.20:80/
ProxyPreserveHost On 

You will need the ProxyPreserveHost to retain the hostname variable so most applications that use it report the proper information (ie. php's $_SERVER['SERVER_NAME'] )

each proxy forward virtual host points to all the servers and it works fine.
The only other thing you want is probably to patch the ispc so the VirtualHosts listen to *:80 which is not _really_ required but makes maintaining the DNS with a private IP easier.

btw, the router can't determine the sites without inspecting the packets.. you need a forwarding proxy (or a master ISPC server to handle all connections and forward to the correct server once it knows which site and where to redirect the requests)...



gotta go, wife bitching to leave.


All times are GMT +2. The time now is 19:52.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.