This is a personal and professional blog of a Network Administrator's/Avid Gamer's knowledge and passions in Minneapolis.
I'm always looking to improve my skill set, and even more so I enjoy passing that knowledge along to others about my craft.
I always feel like IT limits what people do, so I aspire to enable technology, and explain complex things in simple terms.
More

Multiple live VMware Servers, single external IP. Apache vhosts + Mod Proxy

One note: this post is link heavy for those who don’t know all the IT lingo and acronyms.

Problem: your client or company has multiple unique OS configurations for a handful of different low traffic websites running various types of software; maybe ROR installs, maybe plain LAMP servers for Wordpress blogs, whatever it might be. These sites need to be publicly available, secure, and easily transportable if load balancing needs to occur. You also only have one external IP available.

Solution: Single server running individual VMware instances for each unique environment on the internal NAT of the “metal” machine. Then utilize mod_proxy/mod_proxy_http, and virtual hosts to direct traffic to the correct virtual machine instance. I learned this trick from an endeavor with one of my mentors; utilizing mod_proxy to get around cold fusion developers edition licensing issues, which is probably in the grey area of legality. But a fun use none the less. I’ve documented this here. Maybe I will update it a little more someday.

In this case, our base machine is less than ideal for for virtual machines, but should be plenty functional for a number of low traffic/low resource sites.  See picture.

picture-2

Perfectly good for a half dozen Ubuntu VM’s.

Anyways we have a base install of Windows Server 2008 x64 in an Acme 1U server case with a Supermicro X7SBL-LN1, an Intel 2.4Ghz Dual-Core E4600 , 6GB of memory [including 4GB of this cute Kingston VLP (very-low-profile) memory], and a pair of 320GB Western Digital RE3 hard drives mirrored for the system with the basic Intel Storage Matrix RAID. Note that server 2008 didn’t need a custom hard drive controller driver to see this, and needed next to no drivers, which also made me happy. Much like my recent jump into Windows 7. I wish the CPU has some sort of VTS, but, oh well.

I was having problems with Ubuntu and motherboard fake-RAID. In Ubuntu if your primary disk fails you have to edit the line in GRUB to get it to boot off the other disk, where as Windows recognizes both disks as a fakeraid volume, and will still boot if either disk fails, as well as auto-rebuild.

Once 2K8 was up and running, updates running, a fresh copy of VMware 2.0 was installed in a very default fashion. I used Ubuntu 8.04LTS server edition to make a test VM, took about 10 minutes to set up in a basic LAMP server with a static IP. the VM was using the NAT configuration option. Once that was running I went ahead and configured the apache config file.

uncomment the include for httpd-vhosts.conf

uncomment the include for httpd-vhosts.conf

uncomment these apache modules.

uncomment these apache modules.

Be sure to uncomment those things. You’re including the vhosts.conf file, which has the instructions on creating virtual hosts. You’re also uncommenting the modules you need to do the proxy-pass through and the virtual hosts

After that, configure the httpd-vhosts file your httpd.conf references above [/extra/httpd-vhosts.conf]. This sets all IP’s on port 80 to use name-based virtual hosting. Read on.

Uncomment this line to enable name based virtual hosting.

Uncomment this line to enable name based virtual hosting.

Below we have one configuration for the simple landing page [note that the server is called bacon.domain.com, and the VM is called ubuntutest1.domain.com.

picture-9

Example httpd-vhosts.txt file.

I’m not sure I have the proxy entry totally perfect, but it appears to be working.

So, pretty cool huh?

-C

Tags: , , , ,

Leave a Reply

You must be logged in to post a comment.