Last updated March 25, 2014. Created by on April 2, 2011.
Edited by barone, cmalek, aaron, jhr. Log in to edit this page.

Drupal allows you to run multiple sites from a single Drupal code installation -- each with its own modules, content, theme, etc. For instance, you can run:

  • Multiple sites on your local computer
  • Multiple domains in a single hosting account
  • Multiple sub-domains
  • Multiple sub-directory sites

For a live multi-site installation, see Multisites Using Drupal 7.

These pages describe one way to run multiple test sites on your local computer with Drupal 7 on Mageia 3 or 4 or Ubuntu 11.04. But the method probably works with little modifications for other distributions. Purposely, we only present one way to do that, in details, and we try to explain a bit what we're doing. We're not sure whether this procedure contains mistakes or not, and we think it probably contains useless things.

Note: if you are creating multiple sites, it is desirable to make a list of the desired sites before reading through these instructions completely. Some steps can be done in bulk to save time.

Why create extra sites? In addition to having several sites running already, you may have some ideas in the back of your head for other sites that you might put up in the future. So before you totally pooh-pooh the idea, give it a few minutes' thought. And you can always change your mind later; it just might be a bit messier then.

The Basics

In a normal situation, any web page is served by a server to a client, as a meal in a restaurant. "Server" refers both to a computer (usually a mainframe) or to a piece of software. Both are necessary to do the job. Similarly, "client" refers both to a computer (usually a PC) and to a piece of software, such a Mozilla Firefox or Google Chromium. Here, a same computer (yours) will be the server and its own client, but the server and client applications keep separate. In this page, we chose Apache as the server software. You may wonder why a server piece of software is even necessary on your computer. After all, you can just double-click on any HTML file to see it in your browser, even if Apache is not installed. This is because HTML, XHTML, CSS and JavaScript are interpreted client-side, i.e. by the browser itself. On internet, they are served by a server, but, on your local computer, they can be read directly. But Drupal also uses PHP, a programming language interpreted server-side: even on your own computer, if you don't have a server piece of software installed, the program will not be interpreted, and Drupal will not work. In Ubuntu, Apache serves the files in the /var/www/ hierarchy (in Mandriva Linux 2010 and Mageia 3, it is /var/www/html/), except if taught another location.

The main idea in this multi-site installation is that you need a MariaDB (or MySQL) database and a subdirectory of /var/www/drupal7/sites for each web site. It will be easier for you if their names are identical or similar (except for the default site, whose directory is /var/www/drupal7/sites/default and database is "drupal7"). In the instructions below, the site short name is "example", the database name is "company_example", and the site future URL: "". The database will contain your web site text, while the subdirectory /var/www/drupal7/sites/ (Remember that stands for your website future URL.) will usually contain your web site pictures, specific modules and themes, in subdirectories called "files", "modules" and "themes" respectively. The modules and themes common to multiple web sites are in /var/www/drupal7/sites/all/. The Drupal package installation creates automatically a subdirectory /var/www/drupal7/sites/default/.

The packages

To install the packages, you can use your distribution's package manager: "Ubuntu software center", "Mandriva control center" or "Mageia control center" (then → "Software management", choosing "All" and "All" in the top left corner except if you want to restrain your search.) etc..

  • If your distribution includes Drupal 7, install this package; if prompted to choose between MySQL and MySQLi, choose the latter, and go directly to the paragraph "Mono-site installation of Drupal 7".
  • If your distribution doesn't include Drupal 7
    1. Install Apache, MySQL and PHP: if your distribution includes a meta-package called "LAMP" (Linux, Apache, MySQL, PHP), or "LAMP PHP", use it (In Mageia 3 or 4: Mageia control center → Software management, you can restrain your search to "Meta packages" and "All" in the top left corner. The same for Mageia 3, where the package is called "task-lamp-php".). If your distribution doesn't include such a meta package, install the three packages one by one.
    2. Install also PhpMyAdmin.
    3. (Step not needed in Ubuntu 11 and Mageia 3 or 4, but might still be needed in other distributions.) Install the PHP-PDO MySQL package: in Mandriva 2010, it's called php-pdo_mysql. And enable it: in Mandriva 2010, add the line
      to the file /etc/php.d/70_php.ini .

Steps to follow

Responsibility and acknowledgements

This page, redacted by, includes partial copy and update of the author's contribution to How to documentation for creating Drupal 7 multisite configuration from Drupal's multisite group and Local multi-site installation of Drupal from Mandriva wiki. NancyDru and jcl_vanier are also to thank for the latter.

Other resources

Configuring a basic multisite development environment in Linux
Migrating a site

Looking for support? Visit the forums, or join #drupal-support in IRC.


Hi, I have a quick question.

I have a website on my localhost and 1) I want to give it to a friend to run on her computer, or 2) I want to upload it to the server directly

What are the steps I need to take?

1) Import, send by email, and then my freind need to upload to a server?

2) buy a hosting account with domain name and put it on their server?

Also, when I Import a site which file do I have to click on for a local server?

Thanks, just to get the picture of what I am doing.

Dont know if this is the right place for this article sorry for this... Hope someone can help or redirect.

The bigger you think the more you achieve! :)

Has someone a clear description for multi-sites on a local host on a windows 7 operating system?

thanx in advance!

The bigger you think the more you achieve! :) Web site creation.


The bigger you think the more you achieve! :)

... you really took your time and consideration to write this very useful tutorial.

I have tried previously to set up multi-site installations (of D6) and have failed as those tutorials (or I, oc) missed something out.

This worked well and there is just one quick note:
In Bulk loop 4
should the example be
to keep in line with the previous definition in Bulk loop 3 -
where it reads replacing "example" by the database name, and "" by the directory name.

thanks once more ....

Good luck .....
... more recent results of trying Drupal just once are -

No, this is correct. However, I changed the database name, to be nearer usual share hosting requirements. Web site creation.

... should in Bulk loop 2 the line
Copy /var/www/drupal7/sites/default/ to /var/www/drupal7/sites/
Read more like "Copy the content of /var/www/drupal7/sites/default/ to /var/www/drupal7/sites/"?
When you copy the directory "/var/www/drupal7/sites/default/"
to "/var/www/drupal7/sites/" you would (could) end up
with "/var/www/drupal7/sites/" and in my case that did not work - but later on in the tutorial there is the line
"/var/www/drupal7/sites/" - suggesting that the contents of the default directory - namely default.settings.php and settings.php should simply be under

Well, this "default" directory is causing all sorts of trouble when setting up localhost and multi-site installations - and then when moving the project to a remote host server.

Good luck .....
... more recent results of trying Drupal just once are -

Yes, it shouldn't be copy "to", but copy "as". I've corrected this. Web site creation.

Hi, thank you for the tutorial. I am a little confused with the location of the sites directory:
"The main idea in this multi-site installation is that you need a MariaDB (or MySQL) database and a subdirectory of /var/www/drupal7/sites for each web site."

In my installation, the Drupal sites directory is installed at /usr/share/drupal7/sites instead of where you have stated.

My site seems to work OK, but my question is, can I put the afore- mentioned subdirectory in /usr/share/druapl7/sites

I have tried this on 2 machines, using Linux Mint 16 and Debian 7

Thank you

Hi, is there a map road to install Domain Access from the starting point I find myself in?

I am giving my first steps into the drupal world, not a pro developer level kind.

I need to set up a multi-language, multi country site, starting with 3, to offer my services.
I am in the phase of installing all the modules I will need.

I believe I can get it done if I find the right set of simple instructions to take it from where i am now.

Thank you for any good lead!
Thank you for sharing your knowledge!

I am using the multisite configuration with just one DB instance for all sites. My problem is directly with the usability of theme_image_style.

$sites[''] = 'default';
$sites[''] = 'mobile';

mobile/files is a symbolic link to default/files

- theme_style_image return the right URL.
- does not create the images in files/

I do not understand why images are not created for other sites that are not the default one.

11 years developing amayzing websites and web applications and 4 years working with this technology. I like Drupal, I love Open source!

I've done the whole multi-site thing on remote servers but wanted to copy some sites down and start developing (properly!) on my desktop. Without actual dns entries, the various apache files and options were giving me a real headache. I really admire and appreciate that you took the time to not only figure these details out, but document them well.

If you don't wanna think about changing sites.php everytime you add a new site, here is a little piece of code you can add in this file.

if ($handle = opendir('sites')) {
$blacklist = array('.', '..', 'all', 'default');
    while (
false !== ($file = readdir($handle))) {
        if (!
in_array($file, $blacklist) && is_dir("sites/".$file)) {
$sites[$file] = $file . ".local"; // Change this depending of your nomenclature