Running many sites on single Drupal installation

Yup, you may call it “multisite installation”. That means, you may run more than one site with only a single Drupal core.


Drupal 7.0+

Linux Machine

Step 1: Create a new virtual host

To run multiple sites, we need to create Virtual Hosts in our machine. For example, If I type http://mydrupal I’ll be taken to my drupal site. For that, first we need to change ‘/etc/hosts’ file. Run following command in terminal and provide root password when promted:

gksudo gedit /etc/hosts

Next, add following line to the file and save the file:    mydrupal

Step 2: Restart networking interface

Type in terminal:

sudo /etc/init.d/networking restart

Step 3: Configure Apache2

For the easiest way, go the directory /etc/apache2/sites-enabled. Here, you will see a file named something like 000-default (or whatever), open it for editing. Place following code for opening it for editing:

gksudo gedit /etc/apache2/sites-enabled/000-default

Now, you need to create a <VirtualHost> directive:

    ServerAdmin []

    DocumentRoot /path-to-your-drupal/

    ServerName mydrupal

    <Directory />
        Options FollowSymLinks
        AllowOverride All
    <Directory /path-to-your-drupal/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

    RewriteEngine On
    RewriteOptions inherit


Note that <VirtualHost> should contain the IP address you provided in step 1, we chose “” since it will be pointing to your own machine. Also, note the line ServerName mydrupal – here “mydrupal” is the name we chose in step 1.

Step 4: Restart Apache2

Type in terminal:

sudo /etc/init.d/apache2 restart

Yup, that’s all!


Type http://mydrupal in your browser, you will see the new drupal site running! Now you can create all the necessary files (database settings, modules, themes etc.) under sites folder of your Drupal path. Copy the path-to-drupal/sites/default folder and rename it to path-to-drupal/sites/mydrupal.

Next, you can (should):

  • Edit “path-to-drupal/sites/mydrupal/settings.php” – for database settings. Change database username, password, database name etc.
  • Create a new database if necessary, using PHPMyAdmin, or whatever.