Created on 03 Jan 2013 ;    Modified on 29 Sep 2013 ;    Translationitalian

Multisite Drupal - How to install a new site


Drupal allows to install multiple web sites using a single instance of the code. This capability was introduced in the core of the system since version 6 (at the time of writing this note, the stable version of Drupal is 7).

This article summarizes the steps necessary to install an additional web site on a server already running Drupal multisite. And is derived from the procedure showed in Drupal documentation.

I would assume that:

The examples are based on the following parameters:

As you can see, I prefer to have two files in the Apache configuration directory /etc/httpd/conf/. The httpd.conf file contains base parameters configuring Apache. While the httpd-hosts.conf contains virtual hosts sites configurations. The httpd-hosts.conf is included in the file httpd.conf using an include directive, such as the following line:

Include "/etc/httpd/conf/httpd-vhosts.conf"

Again, if you want to use some of the following examples to your Drupal installation, be careful to use consistently the directories names of your your installation directories.


We are going to do the following steps:


Create the directory Site

Login as administrator on the server, and create the directory in which to host the site contents. For example:

[root@host ~] # cd /webroot/drupal/sites/
[root@host sites] # mkdir
[root@host sites] # cp default/settings.php
[root@host sites] # chown-R apache:apache
Configure the virtual host for the site

Make a backup copy of the file /etc/httpd/conf/httpd-hosts.conf 1, for example:

[root@host sites] # cd /etc/httpd/conf
[root@host conf] # cp httpd-vhosts.conf httpd-vhosts-121228.conf

After that, you edit httpd-hosts.conf using a text editor to add the following section:

<VirtualHost Xx.yy.zz.ttt:80>
  DocumentRoot "/webroot/drupal"
  CustomLog "logs/" combined
  ErrorLog "logs/"
  <Directory "/webroot/drupal">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow, deny
    Allow from all
  </ Directory>
</ VirtualHost>

Then restart the service:

[root@host sites] # service httpd restart
Stopping httpd:                             [OK]
Starting httpd:                             [OK]
(Optional) Enter server address in hosts file

This task is required if the new site isn't added yet to a public DNS, but you should use it (see the next step: run

If you are using a Windows PC with the operating system installed in c:\windows\, you will need to edit the c:\windows\system32\drivers\etc\hosts file by adding the line:

Create the database for the site and the related user

Now we need to create a database used by the new site, and the user needed by Drupal to use it. We use the mysqladmin program to create the database, presenting us as MySQL administrators:

[root@host sites] # mysqladmin -u root -p create esempio_db
Enter password:

After that we create the user using the mysql program. Again, presenting us as MySQL administrators:

[root@host sites] # mysql -u root -p
Enter password:
Welcome to ...
mysql> create user 'esempio_usr' @ '%' IDENTIFIED BY 'esempio_pwd';
mysql> grant select, insert, update, delete, create, drop, index, alter, create temporary tables, lock tables on esempio_db. * to 'esempio_usr' @ '%' IDENTIFIED BY 'esempio_pwd';
mysql> create user 'esempio_usr' @ 'localhost' IDENTIFIED BY 'esempio_pwd';
mysql> grant select, insert, update, delete, create, drop, index, alter, create temporary tables, lock tables on esempio_db. * to 'esempio_usr' @ 'localhost' IDENTIFIED BY 'esempio_pwd';
mysql> exit

As you can see we have configured the user esempio_usr to work both in connection remotely from every IP address (@'%'), either locally to the server (@'localhost').


Using a web browser we go to and answer to the program questions. The program install.php should be used only once, and, based on your answers, it adjusts appropiatly the configuration file of the new Drupal site.

Among other things, this program creates an account for the administration of the site, asking us for name, email and password we want to use. Keep in touch these credentials. If we lost them, will be hart to administer the the site ...


  1. Remember: this file is included in /etc/httpd/conf/httpd.conf using the directive:

    Include "/etc/httpd/conf/httpd-vhosts.conf"