TurnKey Linux Virtual Appliance Library

Drupal Multisite / Apache Virtual Hosts

chris_17728's picture

After spending the afternoon scratching my head on this, I've figured out how to perform a Drupal multi-site install using Turnkey Drupal6 and Amazon EC2. 

(This information is based upon other more general Drupal articles but is specific to issues using Turnkey Drupal 6 on AWS.)

First carefully follow instructions elsewhere on this site on successfully setting up the Drupal 6 Appliance as an instance in the Amazon cloud.  Ensure that the Default single drupal is running prior to creating a multisite host.


  1. First go to phpmysql and verify that you have a user setup with the proper permissions.  If not create a user with SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER permissions. (in this example we will use user "drupal6")
  2. Then create an empty db for my site: eg: mysite_db
  3. Go to /usr/share/drupal6/sites/ and copy the default directory
  4. Renamed the default directory according to the name of the domain: eg: mysite.org
  5. Open up mysite.org directory and edit the dbconfig.php file.
  6. 		$dbuser='drupal6';
  7. Save file. 
  8. Repeat steps 3-7 for each of the sites you will be hosting.
  9. Then open the Apache configuration file at /etc/apache2/sites-available/default

  10. Look for the Directory sections for "/" and "/var/www/" and change the line:

    AllowOverride None
    AllowOverride All

    (See https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles for more information).
  11. Save this file.

  12. Create a new vhost file and enter the following - replacing bolded items  (this is a funtional example):

  13. 		<VirtualHost *:80>
        ServerName www.mysite.org
        ServerAlias *.mysite.org
        UseCanonicalName Off
        ServerAdmin  admin@mysite.org
        DocumentRoot /usr/share/drupal6/
    <Directory /usr/share/drupal6/>
        Options +FollowSymLinks
        AllowOverride All
        order allow,deny
        allow from all
  14. Close and save the vhost file using a name based upon your site's domain (eg: mysite.org )

  15. Repeat steps 12 - 14 for each of the sites.

  16. Now that vhost files have been created, for each site you wish to enable, enter "a2ensite sitename" (example: "a2ensite mysite.org")

    (for more information about a2ensite and a2dissite see here)

  17. When you are finished reload apache.

  18. 		sudo /etc/init.d/apache2 reload
  19. Go to your DNS hosting service and, for each domain set the CNAME record to the AWS Public DNS (example: www = ec2-85-121-347-131.compute-2.amazonaws.com).  Set the A (HOST) record to either the public DNS or IP number.  (Sorry, not trying to be vague, but this step differs widely depending upon vendors and is beyond the scope of this tutorial).

  20. Then go to the drupal install page for your new site (eg: www.mysite.org/install.php ) and follow the standard Drupal install proceedure.

  21. Enjoy your Drupal multi-site!

Guest's picture

Works on localhost on my laptop as well

Just wanted to let you know that this works great also on my laptop. Just got a new one and am setting up a development system to mirror the multisite install I manage.

Only thing I did different was step 19. Instead of that, I edited my /etc/hosts file and pointed to my dev.sitename.com site.



Guest's picture

I also wanted to tell you

I also wanted to tell you that it works just fine on my laptop as well and I use ix webhosting. Thanks for the effort of explaining everything. I tried both your way and that of Tim and both worked.

Guest's picture

Instructions 12 & 13

Instructions 12 & 13 Problem

I have a file in - /etc/apache2/sites-available

It is named drupal6 which is also the name of my original site database

it's contents are:

NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80>
    UseCanonicalName Off
    ServerAdmin  webmaster@localhost
    DocumentRoot /usr/share/drupal6/

<VirtualHost *:443>
    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/cert.pem
    ServerAdmin  webmaster@localhost
    DocumentRoot /usr/share/drupal6/

<Directory /usr/share/drupal6/>
    Options +FollowSymLinks
    AllowOverride All
    order allow,deny
    allow from all

Is this the vhost file you are referring to?

Can you guide me on how to modify it.

By the Way - I am using:

Drupal 6 Appliance - Powered by TurnKey Linux

It is installed on a local server - not in the cloud.  Want to set up multisites locally on the Drupal appliance for production and testing.
Hope that give you enough info to help. 
Guest's picture

server error 500


Unfortunately it's not working for me. I am running TKL drupal6 on vmware fusion and have set the /etc/hosts file in osx to point to the server with a test domain name.
When I try to reach the multi site the server gives a 500 error.
I am a bit puzzeld because I can't find any other good resources that give me a clue why this behavior is happening.
Hope someone can shed some light on this issue
Guest's picture

Follow up Server Error 500

Ok, i found the problem. This will probably also apply for the other post.

The permissions on the dbconfig.php and setup.php were to restrictive. I have set them to 644 and 640 respectively. This fixed my problem.

I hope this helps!

Guest's picture

drupal 6 and drupal 7

How would you install drupal 7? In the sites directory of drupal 6? C

Also Can you upgrade webmin and install Virtualmin to enable more than just drupal 6?

Jeremy Davis's picture

Yes you can

But as Drupal 6 is installed from the default Ubuntu repos you shouldn't just overwrite the files.

To get rid of the current Drupal 6 first you would use a command something like: apt-get remove drupal6 (assuming drupal6 is the name of the package). This will retain the current config for Drupal (which may or may not be useful - to get rid of all config info too use the --purge switch).

Then to install Drupal 7 you should be able to find an online tutorial (perhaps in the Drupal documentation) on how to install it to Ubuntu 10.04/Lucid (the basis of TKL v11.x).

And yes you can upgrade Webmin and install Virtualmin but I'm not sure on the best way to go about it. But as TKL is comletely open source you can pretty much do anything you want (assuming that it's technologically possible and you have the expertise or access to someone that does).

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)