You are here
Drupal Multisite Setup
Debian (Ubuntu)
1. Configure Apache2 for Sites :
Before you jump to configure your virtual hosts do not forget to add host names in /etc/hosts file.
your.ip.add.res vritualhost_1.name
your.2.ip.add.res virtualhost_2.name
2. Apache2 needs to be configured to support vhost access to your new sites.
Create vhost site configuration files in /etc/apache2/sites-available/
#
# Virtual hosting configuration for Drupal
#
ServerAdmin [your email address]
DocumentRoot /usr/share/drupal6/
ServerName [your vhost#1 name]
ServerAlias [if you want to support www.example.com and example.com]
RewriteEngine On
RewriteOptions inherit
ServerAdmin [your email address]
DocumentRoot /usr/share/drupal6/
ServerName [your vhost#2 name]
ServerAlias [if you want to support www.example1.com and example1.com]
RewriteEngine On
RewriteOptions inherit
[...repeat for all your vhosts]
3. Sym-link the drupal file in the sites-enabled directory to enable it in your site:
# cd /etc/apache2/sites-enabled
# ln -s ../sites-available/drupal .
4. reload Apache2 to pick up your configuration changes...
# /etc/init.d/apache2 reload
5. Create Drupal Site Configurations
We need to create Drupal configurations for each site by copying the default configuration to the Drupal site subdirectory.
# cd /etc/drupal/6/sites/
# cp -a default [site1.com]
# cp -a default [site2.com]
6. edit the configurations to use the right database, MySQL user name, and password...
# vi site1.com/dbconfig.php
# vi site2.com/dbconfig.php
7. Run Drupal and Configure Your Sites
Browse to your sites, running install.php (e.g. http://www.example.com/install.php) to configure them.
Manual
Get to location where Drupal core will be located:
[/]# cd /var/www
Upload Drupal core:
"x.x" should be replaced with the version of Drupal you're installing, e.g. "5.2"
[/var/www]# wget http://ftp.osuosl.org/pub/drupal/files/projects/drupal-x.x.tar.gz
Unpack Drupal core:
[/var/www]# tar -zxvf drupal-5.2.tar.gz
Move contents of Drupal core (including .htaccess) to html:
[/var/www]# mv drupal-x.x/* drupal-x.x/.htaccess /var/www/html
Clean-up:
[/var/www]# rm drupal-x.x.tar.gz
[/var/www]# rm drupal-5.2
Create the files directory per Drupal instructions and change permissions (will change permission again after install):
[/var/www]# cd html
[/var/www/html]# mkdir files
[/var/www/html]# chmod 777 files
Make directories that will hold custom and contributes modules and themes:
[/var/www/html]# cd sites/all
[/var/www/html/sites/all]# mkdir modules
[/var/www/html/sites/all]# mkdir themes
[/var/www/html/sites/all]# cd modules
[/var/www/html/sites/all/modules]# mkdir custom
[/var/www/html/sites/all/modules]# mkdir contrib
[/var/www/html/sites/all/modules]# cd ../
[/var/www/html/sites/all]# cd themes
[/var/www/html/sites/all/themes]# mkdir custom
[/var/www/html/sites/all/themes]# mkdir contrib
Create directory "www.example.com.tld":
[/var/www/html/sites/all/themes]# cd ../
[/var/www/html/sites/all]# cd ../
[/var/www/html/sites]# mkdir www.example.com
Change permission of "settings.php" per Drupal instructions and copy "settings.php" in default to www.example.com:
[/var/www/html/sites]# cd default
[/var/www/html/sites/default]# chmod 777 settings.php
[/var/www/html/sites/default]# cd ../
[/var/www/html/sites]# cp -a default www.example.com
Create database and user with permissions:
[/var/www/html/sites]# mysql
mysql> CREATE DATABASE wwwexamplecom_drupal;
mysql> GRANT ALL PRIVILEGES ON wwwwexamplecom_drupal_drupal.* TO 'wwwexamplecom_drupal_myusername'@'localhost' IDENTIFIED BY 'mypassword';
mysql> \q
Go back to PuTTY to chmod on settings.php in www.example.com:
[/var/www/html/sites]# cd www.example.com
[/var/www/html/sites/www.example.com]# chmod 755 settings.php
[/var/www/html/sites/www.example.com]# logout