Home > drupal > drupal multisite xampp single vhosts entry

drupal multisite xampp single vhosts entry

Ah, finally.  It took a while to get my head around the drupal multi-site thing.  Here was the goal, to create a dev environment with as little setup as possible each time I create a new site.  I could have used the acquia install stack or look more into aegir, but I wanted to get it on my own.  The goal was to create a single vhosts entry in httpd-vhosts.conf.  I tried to see if the hosts file could handle wildcard entries, but unfortunately it does not.  Then I started looking into setting up BIND and running my own local dns to avoid having to deal with the hosts file, but that started getting complex and involved too much effort (i.e. got lazy and didn’t feel like blowing up my current stable setup).

So the steps are actually pretty simple:

Step 1.
Decide on a dev domain.  I usually pick an easy to type / remember domain. I also check to see if there is a real website out there before I lose it by changing the hosts file.  Since I was using the acquia distro, I decided on *.aq.com.  In this case all my drupal instances would be something.aq.com. So when I’m developing with ubercart, I can create cart.aq.com, or  client1.aq.com or test.aq.com.

Step 2.
You’ll need a VirtualHost setting in your httpd-vhosts.conf file.  I run my server on port 8090 for testing, my entry looks like this:

#acquia settings
<VirtualHost *:8090>
 ServerName www.aq.com
 ServerAlias *.aq.com aq.com
 ErrorLog "O:/www/drupal.osm.com/logs"
 LogLevel notice
 RewriteEngine On
 RewriteOptions inherit

 DocumentRoot "O:/www/drupal.osm.com/html/aq"
 <Directory "O:/www/drupal.osm.com/html/aq">
 Options Indexes FollowSymLinks MultiViews ExecCGI
 AllowOverride All
 Order allow,deny
 allow from all
 </Directory>

</VirtualHost>

A few things to note:

  1. The server is running on port 8090, so to get to a site in the browser I’ll need to access: http://cart.aq.com:8090
  2. osm.com – I create all my project folders with this suffix (OpenStep Media)
  3. document root is where acquia is setup, in this folder you’ll see the main drupal index.php file

Step 3.
You’ll need to update your hosts file in c:\windows\system32\drivers\etc   here’s an example.  You’ll need to do this for every site.  I’d like to add a plugin to the xampp control panel to either add entries, or at least create a shortcut to the file (nudge, nudge apachefriends)

#aquia sites
127.0.0.1       test.aq.com
127.0.0.1       web.aq.com

Step 4.
Restart apache.

Step 5.
This is the most important step, and the one that was driving me nuts, but yet so simple.  You will have to go into your drupal install, to the sites folder.  In there you’ll see a folder called “default”.  You’ll need to copy this folder to a new folder name that matches what you put into the hosts file.  So your new folders should be: “test.aq.com” and “web.aq.com”

When you navigate to http://test.aq.com  – you should get the install screen, the same with web.aq.com

Good Luck!

Advertisements
Categories: drupal
  1. google adsense websites
    June 24, 2010 at 5:18 am

    You are a very smart person! Did you write this yourself? If so do you have more of it somewhere?

  2. October 30, 2010 at 10:15 am

    You you should change the blog subject drupal multisite xampp single vhosts entry TechDad to more generic for your subject you make. I liked the the writing however.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: