Multi-site on Windows

Last modified: October 17, 2008 - 17:17

Software

This guide assumes you have installed WAMPServer, which you can download below:

Alternatively, you can install another WAMP package, but you will need to adjust the paths as necessary.

Process

  1. Set up Drupal as usual
    1. Install WampServer (or another 'WAMP' package) and make sure that Apache and MySQL services are running.
    2. open phpMyAdmin in your browser localhost/phpmyadmin (or it can be launched via the WampServer icon in your system tray.)
    3. Create a new database -- we'll call it drupal6 because this will be our base installation which we will leave untouched. While you're here create a second and third database, which we'll call site1 and site2. You can also change the database privileges if you want, but to keep things simple here, we'll stick with the default user root and no password.
    4. Download Drupal 6 into WampServer's wamp/www folder (or the htdocs folder in Xampp and some other packages). (You'll need a tool like 7-zip to unpack the Drupal tar.gz file).
    5. Do your first Drupal installation by pointing your browser to your Drupal folder, which should be something like http://localhost/drupal-6.x. Enter the drupal6 database and user settings (root and no password in this example). Complete the installation, but then leave it alone.
  2. Prepare the files for your new multi-sites
    1. Find Drupal's sites folder, make a copy of the default folder and rename it to the URL you want for your first test site. To keep it simple, we'll make it the same as the first test site database: site1. While you're here, create files, tmp and themes sub-folders within this new folder. The themes sub-folder will be used for any custom theme you create specifically for this site. Similarly, you can create a modules sub-folder for any module you use only with this site. However, generally, I find it easier to keep all contributed modules together in the sites/all/modules folder so I can use them with all my test sites.
    2. Use a text editor to open the settings.php file in your new site1 folder and change $db_url line to reflect your first test site database, and the database user name and password, eg:
      mysql://username:password@localhost/site1
      Also, change the $base_url to the above site URL, eg:
      $base_url = 'http://site1'; // NO trailing slash!
    3. Repeat the above 2 steps for the other test site (site2)
  3. Adjust windows so it can find the new site at a new made-up name

    Find the Windows hosts file, which should be in Windows' System32/drivers/etc folder, make a backup of that file and then open the hosts file in a text editor. Here, add new lines mapping your localhost IP address to match the URLs of your test sites and your original Drupal site. In our example, it would look like this:

    127.0.0.1 localhost
    127.0.0.1 site1
    127.0.0.1 site2
    127.0.0.1 drupal6

    This is telling Windows Networking that http://site1/ is a name for this machine.
  4. Adjust Apache so it responds to requests for the new names
    1. Find the Apache httpd.conf file which, in WampServer, should be in the wamp/bin/ApacheX.X/conf folder (where X.X is the Apache version number). Sorry, I can't remember where Xampp installs this, but it will be in the Apache folder. Anyway, all you need to do with this file is make sure the "Virtual hosts" line is active by removing the # before Include conf/extra/httpd-vhosts.conf.
    2. Make a backup of that httpd-vhosts.conf file (which is in Apache's conf/extra folder), then open httpd-vhosts.conf with a text editor and add these lines:
      <VirtualHost *:80>
      DocumentRoot C:/wamp/www/drupal-6.x
      ServerName site1
      </VirtualHost>

      where C:/wamp/www/drupal-6.x is the path to the Drupal installation folder and site1 is the URL for your first test site. Add another entry for your other test site, another entry for your original Drupal installation and another entry for WampServer's localhost URL (if you want to keep this active), eg:
      <VirtualHost *:80>
      DocumentRoot C:/wamp/www/drupal-6.x
      ServerName site2
      </VirtualHost>

      <VirtualHost *:80>
      DocumentRoot C:/wamp/www/drupal-6.x
      ServerName drupal6
      </VirtualHost>

      <VirtualHost *:80>
      DocumentRoot C:/wamp/www
      ServerName localhost
      </VirtualHost>
    3. Restart Apache for the changes to take effect. With WampServer, this is done by selecting the WampServer icon in the system tray and then "Restart all services".
  5. Now you're ready to install each Drupal test site using your browser, eg:
    http://site1/install.php
    http://site2/install.php

And that's it. You can access your two test sites anytime WampServer is running by using the http://site1 and http://site1 URLs.

As I said, it's not exactly simple, but it is well worth the effort. Now you can do whatever you like with your test sites. If you mess up with, say, site1, just delete the site1 folder, the site1 database in phpMyAdmin and the site1 entries in the Windows hosts and Apache httpd-vhosts.conf files and start again. Alternatively, if a site works out and you want to go live with it, the multi-site approach makes this easier (in my opinion).
One final caveat: I'm no expert. This technique works for me (apart from one corporate environment with a particularly annoying proxy server), but I'd welcome any feedback, especially if there are any accuracies.

. . . and when there's a proxy

glennr - July 29, 2008 - 04:21

I found the above technique didn't work on a heavily locked-down corporate network with a proxy server. So to get around this problem, I made every local Drupal site a subdomain of localhost. In other words, the test sites needed to have URLs such as http://site1.localhost. To do this, just follow the above technique with these exceptions:

  • When creating sub-folders for your test sites inside Drupal's sites folder, name those sub-folders site1.locahost and site2.localhost.
  • When editing the settings.php files within the above folders (and the default folder), change the $base_url lines to $base_url = 'http://site1.localhost'; and $base_url = 'http://site2.localhost'; and $base_url = 'http://drupal6.localhost';
  • Change the entries in the Windows hosts file to: 127.0.0.1 site1.localhost and 127.0.0.1 site2.localhost and 127.0.0.1 drupal6.localhost
  • When editing the Apache httpd-vhosts.conf file, change the ServerName lines to: ServerName site1.localhost and ServerName site2.localhost and ServerName drupal6.localhost

This allowed me to access http://site1.localhost, http://site2.localhost and http://drupal6.localhost despite that pesky proxy.

Permissions for Windows hosts file

glennr - September 9, 2008 - 14:49

For those who've never edited their hosts file, here's how you get permission to do so in Vista: http://support.microsoft.com/kb/923947.

File locations for Leopard

colin_young - September 26, 2008 - 03:00

Here is where the files are located in OS X Leopard:

/private/etc/hosts
/private/etc/apache2/httpd.conf
/private/etc/apache2/extra/httpd-vhosts.conf

httpd.conf file in Xampp setup

Tim_Olaguna - October 18, 2008 - 22:37

"Find the Apache httpd.conf file ... Sorry, I can't remember where Xampp installs this, but it will be in the Apache folder."

On my Windows Vista machine I found it in xampp/apache/conf/httpd.conf . The required line was already active, so no change was needed.

Cheerily Yours,
Tim O'Laguna

Former Commodore 64 Junior Wizard

rename default.settings.php

Max_Headroom - October 22, 2008 - 10:24

In step 2.1, where you copy and rename the default folder, also rename the default.settings.php to settings.php in your new folder.

One database

Max_Headroom - October 22, 2008 - 12:36

You can also have only one database with different tables for each multi-site.
In step 1.3 above, create only one database.
Ignore step 2.2 and 2.3, leave the settings.php as is.
and in step 5, when you start a new site, you will be asked to enter the database name, user name and password. Enter the same database information you created in step 1.3 for every site.
Click on Advanced settings and enter a table prefix such as "site1_" or "site2_".<<< this is important!

That's it.

All the Drupal tables will be recreated with your sites prefix added to the table. There's a way where you can share common tables over all the sites, but it makes things a bit more trickier. The procedures for this are documented elsewhere.

... and when DocumentRoot has spaces

i.chris.jacob - February 12, 2009 - 06:47

In httpd-vhosts.conf if your DocumentRoot path contains SPACE characters you will need to contain the path in quotes.

Example:
DocumentRoot "C:\Documents and Settings\Chris\Desktop\sites\drupal"

I'm sorry, I followed the

michaelbr - February 14, 2009 - 06:17

I'm sorry, I followed the steps above, but it isn't working, I'm not sure what's wrong, can someone please give me a hand? I've been struggling with the multisite setup for 3 days already and couldn't find a solution, I've done everything step by step according to instructions above, but when I went to my new site, it just accessed the primary domain (localhost) and not the subdomain/subfolder, what I'm doing wrong? This is my setup:
WAMP 2.0 on XP,
D6 installed on c:\wamp\www
sub1 ==> c:\wamp\www\sites\sub1
sub2 ==> c:\wamp\www\sites\sub2
I've changed the host, httpd.vhosts.conf and httpd.conf files according to instructions, and copied settings.php & files dir into sub1 and sub2, and copied default.settings.php from /default into sub1/settings.php and sub2/settings.php.

when I go to the http://sub1.local, it just showed the original install of D6 and not the one in sub1, what I'm missing? It seems some configuration setting is missing to tell D6 where to look for sub1 folder, where can I set that up?

when I tried to run http://sub1.local/install.php, I got the following message:
Drupal already installed
To start over, you must empty your existing database.
To install to a different database, edit the appropriate settings.php file in the sites folder.
To upgrade an existing installation, proceed to the update script.
View your existing site.
so definitely it's seeing my first install and not the one in the subfolder.

ps: I set in my host file 127.0.0.1 sub1.local and this is what I added in my httpd.vhosts.conf file:

DocumentRoot "C:/wamp/www"
ServerName ppe.local

Allow from all
Options +Includes +Indexes +FollowSymLinks
AllowOverride all

DocumentRoot "C:/wamp/www"
ServerName brexpat.local

Allow from all
Options +Includes +Indexes +FollowSymLinks
AllowOverride all

DocumentRoot "C:/wamp/www"
ServerName localhost

Allow from all
Options +Includes +Indexes +FollowSymLinks
AllowOverride all

TIA

Michael
Einstein: "The world is a dangerous place to live; not because of the people who are evil, but because of the people who don't do anything about it."

wrong folder name

dman - February 14, 2009 - 06:44

Consider the difference between 'sub1' and 'sub1.local'.
They are different.
Use one or the other.

The example above does not magically insert '.local' halfway through the process like you did.
If you wanted to use *.local (there are good reasons for doing this) then you could have followed the example documented above also.

So either rename the subsite folder to /sites/sub1.local (easiest)
or set your host up to answer to http://sub1/

There IS a fallback pattern that is used to calculate shorter foldernames for your subsite folder - it's documented in settings.php and elsewhere. But if you read that documentation, you'll see the pattern chops up from the left - not the right.
http://sub1.local/
will serve from the configs found in
/sites/sub1.local/
/sites/local/
/sites/default/
... but NOT
/sites/sub1/
... which would involve chopping from the right instead.

.dan.
if you are asking a question you think should be documented, please provide a link to the handbook where you think the answer should be found.
| http://www.coders.co.nz/ |

dman: Thanks so much for

michaelbr - February 14, 2009 - 08:12

dman:
Thanks so much for pointing out my error, I was so frustrated and didn't read carefully settings.php. Now it works. Thanks again.

TIA

Michael
Einstein: "The world is a dangerous place to live; not because of the people who are evil, but because of the people who don't do anything about it."

Thank you!!

mrothmay - March 3, 2009 - 17:58

I just want to say thanks for the clear, step by step explanation that helped a newbie get multi-sites set up. After struggling with this for hours, your directions worked for me. Thanks!!

404?

eananes - March 15, 2009 - 17:19

hi. i'm learning drupal (as well as all the other web development essentials) as i go along. i've followed the instructions as best i could on this page but when i get to the very last part, i get a 404 error.

i'm running on xampp and i've added the additional database, figured out the differences in the relevant file locations, and made the necessary modifications, but when i go:

http://site1/install.php

the Object not found! (404) error comes up.

where did i go wrong?

learning Drupal... one challenge at a time. :)

perhaps look at....

nwwoman - March 24, 2009 - 03:05

does your "site1" point to your drupal install? In multisite, all domains in the sites folder must point to the same drupal install location when you set up your virtual hosts file in apache httpd.conf

i'll check it again

eananes - March 24, 2009 - 03:35

thanks for the tip. if all else fails, i'll just reinstall and start as a multi-site setup.

learning Drupal... one challenge at a time. :)

XAMPP vhost problem and solution on local Windows XP test server

sbsmith - April 9, 2009 - 07:31

Hi. I tried following the step-by-step for XAMPP and encountered an unusual problem where my http://localhost would redirect to C:/xampp/htdocs/drupal instead of the C:/xampp/htdocs that its VirtualHost tag pointed to. This seemed bizarre to me, as I had followed the steps properly, and when I would erase the VirtualHost tags for my original drupal site and test site, the localhost would indeed direct to C:/xampp/htdocs as it was supposed to.

I was able to correct this behavior by uncommenting "##NameVirtualHost *:80" (located in httpd-vhosts.conf) and changing it to "NameVirtualHost 127.0.0.1:80" and created my VirtualHost tags as follows

<VirtualHost 127.0.0.1:80>
    DocumentRoot C:/xampp/htdocs/
    ServerName localhost
</VirtualHost>

<VirtualHost test01>
    DocumentRoot C:/xampp/htdocs/drupal
    ServerName test01
</VirtualHost>

<VirtualHost drupal>
    DocumentRoot C:/xampp/htdocs/drupal
    ServerName drupal
</VirtualHost>

I hope this is helpful for anyone trying to set up a Windows XP test server using XAMPP.

Thanks

indycityboy - April 9, 2009 - 23:47

Thank you, this resolved a problem I was having similar to the above.

The steps work if I start from scrath but ...

rafiqcmnet - May 4, 2009 - 12:27

I am a newbie/non techie.

The abv steps work like a charm. I started from scrath using XAMPP 1.7.1 and Drupal 6.11 and follow the tutorial line by line.

I am a bit stumped though.

I then reinstall XAMPP.

When I restore (a my previous "site" XYZ which I have laboriously worked on) in XAMPP, I fail to add additional multi-sites (like Site1 and Site2 as mentioned in this tutorial). I got all sort of Apache error msgs. The restore of XYZ (a default) using Backup&Migrate was however faultless/no problem.

Any idea what "conceptually" I did wrong?

The Plot Thickens ...

rafiqcmnet - May 4, 2009 - 14:57

I like to pull back what I said "The abv steps work like a charm. I started from scrath using XAMPP 1.7.1 and Drupal 6.11 and follow the tutorial line by line."

I reconstruct again the abv tutorial and I found out:

1. After step 1.5 everything is fine i.e. when you go to http://localhost/drupal-6.x to login/out.

2. After step 1.5 (after finish adding the sites etc.) you'll see a problem.

3. Go to http://localhost/drupal-6.x and http://localhost.

4. When you go to http://localhost/drupal-6.x, page not found although you'll see a drupal page.

5. When you go to http://localhost, you'll see a drupal login page, when you login you'll see the page as described in 4.

TQ

This tutorial needs to be relooked?

rafiqcmnet - May 6, 2009 - 11:58

I found that for this tutorial to work, one should not config the following in the settings.php in the default folder:

$base_url = 'http://localhost/drupal-6.x'; // NO trailing slash!

Instead, config this

$base_url = 'http://drupal-6.x'; // NO trailing slash!

Now it works like a charm. Anyway TQ for the author who put this tutorial up. I was at a lost how to perform a multisite installation.

Mine is ver 6.11 BTW.

really?

dman - May 6, 2009 - 18:21

$base_url = 'http://drupal-6.x'; // NO trailing slash!
Now it works like a charm.

That sounds peculiar.
I can't imagine the above address actually works in your browser unless you've done something extreme to your local DNS.
But if it works for you .. o_O

.dan.

httpd-vhosts.conf in Wamp

Laluen - May 15, 2009 - 15:55

Hi, thanks for this,
but I have a problem :

I don't find this in httpd-vhosts.conf in Wamp

<VirtualHost *:80>
DocumentRoot C:/wamp/www/drupal-6.x
ServerName site2
</VirtualHost>

but this :

<VirtualHost *:80>
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.localhost"
    ServerName dummy-host.localhost
</VirtualHost>

How can I replace this with my multi-drupal sites ?
thx

Issue after Step 1.4

droopypal - May 16, 2009 - 01:53

The problem with this guide is:

You can't continue with Step 1.5 because you must configure settings.php first.

As soon as you select English, you get the "Requirements problem" error message,
so you cannot "Enter the drupal6 database and user settings (root and no password in this example). Complete the installation, but then leave it alone."

Brad

... not necessarily .....

tryitonce - May 27, 2009 - 11:48

You can follow the steps and not touch the settings.php file if you follow the process of installing Drupal completely from new.

That's what I just did and often do when setting up Drupal. This way I avoid any MySQL problems from the start. I can set-up the site and later add all the layout (theme), functions (modules) and content (via MySQL) into a site that is running.

  1. Install drupal - for example under C:\wamp\www\drupal6\
  2. add a new site - C:\wamp\www\drupal6\sites\example-1
  3. set-up a new clean MySQL database - I just simply use http://localhost/phpmyadmin/
  4. call it example-1 (or whatever you prefer) - remember you user name and admin passwort - you can check under "Privileges" (see top bar of the myPHPAdmin page - prob. 7th to the right) and add one or set a new one, you can also check your setting in the file C:\wamp\apps\phpmyadmin3.1.1\config.inc.php or C:\wamp\apps\phpmyadminX.X.X\config.inc.php (where X.X.X is your phpmyadmin version) - the initial installation comes without a password - I can't remember if there is a username included - just check if installing WampServer new. You can also change / add the passworts here.
  5. remember to restart WampServer - or "All Services" otherwise the changes will not register
  6. open the browser and point at http://example-1/ or http://example-1/install.php (both should work)
  7. now you should see the initial Drupal installation page for a fresh installation
  8. once you have gone through the routine of a new installation and the MySQL db is populated with the initial set-up - import your full database as necessary (completely or in parts).
  9. I always take a quick back-up (expoert9 of my initial set-up db in case my Import db is causing trouble. I can then just empty or even quicker completely delete the db, set up a new one with the same name and import the bu of my newly installed site.
  10. do regular flushing and cron runs along the way - see my earlier comment below

You also need to activate all the modules you have set-up for this site. Otherwise some of the features might be missing.

Finally remember there could be timing-out problems and you may want to read - http://drupal.org/node/348202.

keep flushing all caches

tryitonce - May 17, 2009 - 13:04

I followed the guide and got it all going with a lot of patience and by reminding myself to keep flushing all caches.

I use the Administration menu and find it now an essential item and the first module i would install on any site. There are others doing the same job, but old dogs ... - http://drupal.org/project/admin_menu. with this module you have convenient access to manual cron and flushing all or certain caches from the very left side of the menu - under the flavicon.

So, flushing and running cron job is one of the things you should do if something doesn't look right. Sometimes this just works magic (it seems - by doing what they should).

Good luck

...i know this is different but please help

dwight.ian - May 27, 2009 - 04:05

good day.

So to begin, I installed drupal with multisite (as what is described in this page which is a great resource. God job!). Now I have the following sites:

http://site1 - this access the file in c:/where/my/path/drupal612/... (under the sites dir is site1)
http://site2 - this access the file in c:/where/my/path/drupal612/ (under the sites dir is site2)
http://drupal6 or http://localhost/drupal612 - this access the file in c:/where/my/path/drupal612/(i think this access the default)

what I want now is to access site1:
http://localhost/drupal612/site1 or http://localhost/site1 which will be the same as when i access http://site1

and site2:
http://localhost/drupal612/site2 or http://localhost/site2 which will be the same as when i access http://site2

Any ideas??? Thanks

Thanks for the help :D

Step 3 - hosts file under window

tryitonce - May 27, 2009 - 11:56

Dwight,

What exactly is your problem?

If you followed all the advice here and got it all configured well, then you most get something in your browser to tell you it is not working.

Blank screen, error messages, etc. please add them here so we can help you.

A really tricky thing is to manage step 3 - hosts file under Windows:
It should have the following entries:

127.0.0.1 localhost
127.0.0.1 site1
127.0.0.1 site2
127.0.0.1 drupal6 [or 127.0.0.1 drupal612]

When that works you should be able to use the URL of just http://site1 or http://site1/install.php to start up your site.

If this does not work - make sure you

- restarted WampServer (or the package you run for the localhost)
- flash all caches on your browser.

And post your error messages here for further help.

I had to go through the routine above a couple of times before I got it working - you just have to follow the advice step by step. It is easy to slip up.

Good luck

... maybe it is this -

tryitonce - May 31, 2009 - 12:19

Hi Dwight -

could it be this problem I just came across setting up site3 on my system?

See below - http://drupal.org/node/288126#comment-1648268

Good luck

site2 reverts to site1 - check setting.php - $base_url

tryitonce - May 31, 2009 - 12:17

Hi,

how happy I was when I got it working.

Now I am trying to add site3 and followed all the procedures and what happens:

site1 is running fine.
When I now enter http://site2/ or http://site2/install.php - all my browsers revert to http://site1/installphp telling me "Drupal already installed".

Obviously with my settings the browsers are for some reason being pointed only to site1.

And while writing this I found the answer:

settings.php

I had copied settings.php. I prefer fresh starts and I had deleted the setting for site1 MySQL db :$db_url = ' ';.
But I forgot to change the bse_url - because it was a bit further down the screen - just out of sight:

$base_url = 'http://site1';  // NO trailing slash!

once I changed this to site3:

$base_url = 'http://site3';  // NO trailing slash!

all was fine.

Custom Theme Folder?

sparky888 - June 4, 2009 - 15:04

Thanks for the great tutorial! Worked on my local virtual host setup like a charm!!

One question though... You instructed us to put a new themes folder inside the site folder.

I did this, but it's not a choice under the themes list/configuration page for the site.

Should I just put my custom theme in the master drupal/themes folder or what am I doing wrong?

Perhaps there is some config setting I need to change in settings.php file?

EDIT

Nevermind. I got it to work! :) Just had to make a change to the .info file inside the theme folder.

Space Coast Interactive
http://www.spacecoastinteractive.com/

try the handbook.

dman - June 4, 2009 - 15:28

I think this is not specific to a windows install (AFAIK) it's a normal docs thing.
Do not put your theme in the master themes directory.
Follow the instructions here and make sure it's really in the right place
(I just added a screenshot specially for you!)

EDIT: um yeah, or that. cross-post while I went off taking pictures.. :-)

.dan.

It should look like this .....

tryitonce - June 4, 2009 - 20:51

Hi Stephen,

I think it is better to have your theme under your site as suggested by the tutorial. When you move your site to a host it will be a cleaner transfer.

Your directory should look like this:

wamp
|
- www
|
-Drupal6
|
-sites
| |-all (including all contributed / installed modules available to all sub-sites & themes)
| |-default (including files)
| |-site1
| |-site2
| |-site3
| |-site-xyz
| |-site-example
| | |
| | -files
| | |
| | -themes (custom themes for this site =site-example)
| |

If you create a new theme from scratch make sure the info file is correct.
Otherwise it should work fine.

Good luck

multisite for vista -help with symlinks-

maaak - July 1, 2009 - 10:08

Hi everyone,
I have followed enough threads on this to knit a jersey!and fallen into all the drupy error issues and of course been wading through knee deep vista issues, all in a good cause as i am but a newbie on the grail of multisite.
Seem to have been clicking and clicking .Think my issue is with symlinks, Tried it a few months ago with out success and now am back for more and have been at it all week !

c:\users\maaak\>mklink /d c:\wamp\www\drupal-6.12 drupal-6.12\

is the symlink i am attempting and i am told that "Cannot create file a file already exists"

how do you check for existance of symlink ?

am going a tad batty !!!!!

please have a peek at what i am up to and advise

thankyou Drupples .

I am running :
vista/wampserver2/drupal-6.12
and hence:
c:wamp/www/drupal-6.12/sites/testsite1.local
c:wamp/www/drupal-6.12/sites/testsite2
c:wamp/www/drupal-6.12/sites/testsite3
etc

my hosts file
127.0.0.1 localhost
127.0.0.1 testsite1.local
127.0.0.1 testsite2
127.0.0.1 testsite3
127.0.0.1 testsite4
127.0.0.1 drupal6

my httpd-conf
NameVirtualHost *:80

DocumentRoot "C:/wamp/www/drupal-6.12"
ServerName testsite1.local

Options FollowSymLinks
AllowOverride all

Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all

ErrorLog logs/testsite1-error_log //Not necessary, but may help
CustomLog logs/testsite1-access_log common //you track down the problem

DocumentRoot "C:/wamp/www/drupal-6.12"
ServerName testsite2
ServerAlias testsite2 *.testsite2 // This takes care of www.site1, rerouting to site1

Options FollowSymLinks
AllowOverride all

Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all

ErrorLog logs/testsite2-error_log //Not necessary, but may help
CustomLog logs/testsite2-access_log common //you track down the problem

DocumentRoot "C:/wamp/www/drupal-6.12"
ServerName testsite3
ServerAlias testsite3 *.testsite3 // This takes care of www.site3, rerouting to site3

Options FollowSymLinks
AllowOverride all

Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all

ErrorLog logs/testsite3-error_log //Not necessary, but may help
CustomLog logs/testsite3-access_log common //you track down the problem

DocumentRoot "C:/wamp/www/drupal-6.12"
ServerName testsite4
*:80>
DocumentRoot "C:/wamp/www/drupal-6.12"
ServerName testsite4
ServerAlias testsite4 *.testsite4 // This takes care of www.site4, rerouting to site4

Options FollowSymLinks
AllowOverride all

Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all

ErrorLog logs/testsite2-error_log //Not necessary, but may help
CustomLog logs/testsite2-access_log common //you track down the problem

DocumentRoot "C:/wamp/www/drupal-6.12"
ServerName drupal6

DocumentRoot "C:/wamp/www/drupal-6.12"
ServerName localhost

DocumentRoot "C:/wamp/www/drupal-6.12"
ServerName drupal6
ServerAlias drupal6 *.drupal6

Options FollowSymLinks
AllowOverride all

// Same as above
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all

ErrorLog logs/drupal6-error_log
CustomLog logs/drupal6-access_log common

my settings .php
for site 1
$db_url = 'mysql://root@localhost/testsite1';
$db_prefix = '';

for site 2
$db_url = 'mysqli://root@localhost/testsite2';
$db_prefix = '';
$base_url = 'http://testsite2; // NO trailing slash!

for site,3,
$db_url = 'mysqli://root@localhost/testsite3';
#$db_prefix = '';
$base_url = 'http://testsite3'; // NO trailing slash!

for 4

$db_url = 'mysqli://root@localhost/testsite4';
#$db_prefix = '';
$base_url = 'http://testsite4'; // NO trailing slash!

thanx !

MAAAK

sometimes things need to be believed before they are seen

You do not need to touch httpd-vhosts.conf for shared codebase

janusman - July 15, 2009 - 17:22

If you want to run off the same codebase, and only want different modules/settings (e.g. sites/site1, sites/site2, etc) you only need:

* Modify localhosts
* Add directories under sites/ with their appropriate settings.php

Drupal multi-site from the same codebase automatically looks for folders named like the hostname; you do not need to tell Apache anything except where the codebase is (via DOCUMENT_ROOT)

And there's an even simpler solution that doesn't need modifying HOSTS but that'll only let you use 2 sites: http://127.0.0.1 and http://localhost ... just create directories sites/127.0.0.1 and sites/localhost, each with their appropriate settings.php file (and, if you want, modules/ and themes/ directories inside each).

... at least this is what worked for me. I'm using XAMPP-Lite 1.6.8 under Windows Vista.

hey guyz, i followed the

tenx - July 22, 2009 - 13:57

hey guyz,

i followed the instructions here .

but when i go to >>>>>>> http://localhost/drupal-6.12/sites/site2/

i get this permission error message >>> Forbidden

You don't have permission to access /drupal-6.12/sites/site2/ on this server.

Any suggestions

This is what I want to

jsgammato - August 13, 2009 - 20:27

This is what I want to do.
you do not need to tell Apache anything except where the codebase is (via DOCUMENT_ROOT)

How do I do that?

Multisite Test site

sarexpert - August 22, 2009 - 02:36

I have a multisite drupal install working fine in linux lamp. I would like to build a "copy" test site to test upgrades where I can try new things without messing up the production drupal multisite. with main domain of drupal.com addon directory of /sites/example.com
I copied the entire folderset from public_html/drupal/... to public_html/x/...
I mysqldumped the database to a new database
I modified the /sites/example.com to /sites/x.example.com
my settings.php files included an if selector on the database name
I then parked x.drupal.com and x.example.com on the x folder.
It works except that the test system can't find uploaded files in x.example.com

Any ideas what I need to do to make it fully work?

Ted

don't ask here.

dman - August 22, 2009 - 02:50

- 1. no support requests on handbook pages. Any open questions here may be deleted without warning. Use the forums.
- 2. this page is about multisite on widows. Your q is about deployment and replication on LAMPP
... that said, I'm not sure what you mean by 'can't find'. 404 or what? Check your 'file system' settings in the admin section. Check your permissions on the new files folder. Depending on how you copied, things may turn out different. Do not drag & drop or copy & paste. You can usually cp -R but I prefer rsync -a

But seriously - post in the forums, not here.

.dan.

Worked great with note

megeath - October 14, 2009 - 19:09

I worked on this for a while having a lot of trouble, mostly the new sites pointing to the localhost installation and getting the 'Drupal already installed...adjust settings.php file' message. What finally worked was:

- starting from scratch and following the excellent instructions above
- BUT in step 1, not creating a Drupal database and not installing Drupal on the localhost
- creating a site1 db, site2 db, site3 db via phpmyadmin
- adding site folders under c:/wamp/www/site/ with a unmodified copy of default.settings.php and settings.php within them
- modifiying the httpd.conf, httpd-vhosts.conf, and windows/system32...hosts file as instructed

then I entered http://site1 in the browser and voila! there's the Drupal installation page, which installed perfectly, then I entered http://site2 and voila again! Oh Happy Day! Maybe I inadverntantly straightened something out when I started over...but maybe try not installing Drupal as usual. M

Works like a charm

karthick.ajk - November 5, 2009 - 13:58

Thanks for the great guide. it just took me about 10mins to do this, and it works great for me.

@jk

multi-site on XP Pro

50th-state - November 6, 2009 - 00:50

Well I've spent countless hours trying to set up a multi-site on a localhost. Hope someone can help.
Installing Drupal 6.14 I using wamp2 I get the message "Deprecated: Function ereg() is deprecated in C:\wamp\www\drupal6\includes\file.inc on line 902".
Wamp comes with apache 2.2.11 and php 5.3
I was able to get Drupal to installed by downgrading to apache 2.0.63 and php 5.2.9-2.
The problem is that I can't comply with step 4.2 above since php 5.2.9-2 doesn't include a folder conf\extra or the file httpd-vhosts.conf
Any suggestions?

Ok so I'm new at this; I got it to work by applying step 4.2 to the folder in apache 2.0.63 httpd.conf located in my case located at C:\wamp\bin\apache\apache2.0.63\conf

2nd site not loading

50th-state - November 10, 2009 - 00:47

I thought I had this all working but when I attempt to activate a 2nd site at http://site2 the drupal page opens fine but when I select "install drupal in english" the below error appears.

Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\drupal6\includes\file.inc on line 898

This is from line 898: if (is_dir("$dir/$file") && $recurse) {

I was not able to comply with Item 4.1 above as the code "conf/extra/httpd-vhosts.conf" does not exist in the apache 2.0.63 httpd.conf. file. Maybe this is the reason? I was not able to get apache 2.2.11 to work as it is not compatible with php 5.3 and that is the version included with wamp2 so I downgraded to php 5.2.9-2 and apache 2.0.63. The first site loaded just fine. using http:/site1

Help appreciated.

Mike

 
 

Drupal is a registered trademark of Dries Buytaert.