VPS: Hosting WordPress and Flat Websites Together with Apache

I have my own Virtual Private Server (VPS) on which I use the excellent Virtual Multiblog (d'oh - still haven't finished that post) to host multiple Wordpress sites on one server. I then wanted to consolidate some other sites I'm responsible for onto this VPS and save some hosting fees. I didn't want to rewrite them as Wordpress blogs though, and that left me trying to figure out how to host both types of site on one server using WAMP.

UPDATE: Um. Turns out this isn’t the best way to do this. See my second attempt here.

I have my own Virtual Private Server (VPS) on which I use the excellent Virtual Multiblog (d’oh – still haven’t finished that post) to host multiple WordPress sites on one server. I then wanted to consolidate some other sites I’m responsible for onto this VPS and save some hosting fees. I didn’t want to rewrite them as WordPress blogs though, and that left me trying to figure out how to host both types of site on one server using WAMP.

I couldn’t find a tutorial to do this anywhere, so here’s a go. I’m using Apache v2.2.11, and distinguishing between domain names, rather than IP addresses.

*Disclaimer: I’m not (and don’t claim to be) an expert. This could break things, upset your granny or otherwise not do what you want. I’m happy to receive corrections or improvements – or thanks if it works for you!*

First, in Apache’s httpd.conf, enable the VirtualHosts include by changing:

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

to

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Now, edit httpd-vhosts.conf to include a VirtualHost for your domain, e.g.

#
# Use name-based virtual hosting.
#

NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin <you@email.com>
ServerName theflatdomain.com
ServerAlias *.theflatdomain.com