[svlug] Multiple Web Servers on One IP

Chris Miller lordsauronthegreat at gmail.com
Thu May 29 14:39:33 PDT 2008


I've got what I think is a fairly unique problem based on the lack of
documentation.  I recently upgraded to a Virtual Private Server, which
gets me almost every comfort of a full colocation, but without the
hefty price tag.  It does leave me with no swap file and only 300 MB
of RAM.  So I've been working to compress my site into as small of a
space as I can.

I'm using the GForge software package, which eats memory like there's
no tomorrow.  There's nothing else like it, and it's what I want to
use, therefore it's not going away.  I worked out how to keep it from
scaring the other services out of memory by limiting it to only one
simultaneous server request at a time.  So now pages are served on a
first-come first-serve basis, and people who make a page request
during many page requests have to wait for the ones in the queue to
finish.  This is okay, since each page only takes something like 3
seconds or so to finish.  The problem comes when downloading stuff.

If someone tries to download a file, that will cause Apache to block
all page views until that download is finished.  If someone tries
downloading a 12 MB file over dial up, the web site is effectively
down for around ten minutes at a time.

Luckily the software I'm using allows me to define another subdomain
to serve the files, which means another Apache virtual host.  The only
problem there is that even if I make it two vhosts, Apache still
interprets this as two vhosts for the memory-eating web application.
If  I try and download a file while serving a page it works just fine,
but add a third request and it's straight back to standing in line.

What I want to do is to allow for an unlimited number of concurrent
connections on the download domain, but keep the web site locked at
one request at a time.  I looked all through the Apache 2.2 docs and
found nothing like that.  I don't think it wise to run two instances
of apache, either.

So I tried LigHTTPD.  It set up fine, and as far as I know it works
just fine for serving file requests.  It's independent from Apache, so
it doesn't have a problem allowing as many page requests (file
downloads) as there are requests, while apache is still limiting
itself to one request at a time like a good little webserver.

However, I ran into a problem when starting LigHTTPD.  Apache is
monopolizing the only static IP I get.  I'm was using a name-based
domain system to get Apache to serve both domains throught the same
IP.  However, Apache and lighty cannot share the same IP.  I don't
want to buy another static IP because it costs money.

Is there a way to have both of them share the same IP and still
differentiate between the domain and the subdomain correctly?  I don't
want to transfer the whole mess over to lighty, since that'd require
rewriting a lot of configuration directives that I'm not terribly fond
of mucking around with.  I tried to find a solution by myself, but
came up dry.

Just floating a hypothesis, but if I have lighty listening on the
loopback device, and use Apache to mod_proxy to lo, will that work?
Will Apache kick the request to the loopback device without blocking
more page requests?

The client OS is CentoOS 5.1 x86_64.  Thanks for any help you can give
- these webservers are a real nightmare - almost like you could make a
whole career out of it.  We could call it "IT"... ;-)

-- 
Registered Linux Addict #431495
http://profile.xfire.com/mrstalinman | John 3:16!
http://www.fsdev.net/ | http://lordsauron.wordpress.com/




More information about the svlug mailing list