Drupal MultiSites
Jun Abejo
Site-Admin, http://fpdphils.org
Education and Learning Specialist
Foundations for People Dev, Inc. (FPD)
Drupal User since 2008
Instruction on Multisite Set-up can be found in INSTALL.txt
MULTISITE CONFIGURATION
-----------------------
A single Drupal installation can host several Drupal-powered sites, each
with its own individual configuration.
Additional site configurations are created in subdirectories within the 'sites'
directory. Each subdirectory must have a 'settings.php' file, which
specifies
the configuration settings. The easiest way to create additional sites is to
copy the 'default' directory and modify the 'settings.php' file as appropriate.
The new directory name is constructed from the site's URL. The
configuration for www.example.com could be in
'sites/example.com/settings.php' (note that 'www.' should be omitted if
users can access your site at http://example.com/).
Drupal MultiSites
Sites do not have to have a different domain. You can also use
subdomains and subdirectories for Drupal sites. For example,
example.com, sub.example.com, and sub.example.com/site3 can all be
defined as independent Drupal sites. The setup for a configuration such
as this would look like the following:
sites/default/settings.php
sites/example.com/settings.php
sites/sub.example.com/settings.php
sites/sub.example.com.site3/settings.php
When searching for a site configuration (for example
www.sub.example.com/site3), Drupal will search for configuration files
in the following order, using the first configuration it finds:
Drupal MultiSites
sites/www.sub.example.com.site3/settings.php
sites/sub.example.com.site3/settings.php
sites/example.com.site3/settings.php
sites/www.sub.example.com/settings.php
sites/sub.example.com/settings.php
sites/example.com/settings.php
sites/default/settings.php
If you are installing on a non-standard port, the port number is treated as
the deepest subdomain. For example: http://www.example.com:8080/
could be loaded from sites/8080.www.example.com/. The port number
will be removed according to the pattern above if no port-specific
configuration is found, just like a real subdomain.
Drupal MultiSites
Each site configuration can have its own site-specific modules and themes in
addition to those installed in the standard 'modules' and 'themes' directories.
To use site-specific modules or themes, simply create a 'modules' or 'themes'
directory within the site configuration directory. For example, if
sub.example.com has a custom theme and a custom module that should not
be accessible to other sites, the setup would look like this:
sites/sub.example.com/
settings.php
themes/custom_theme
modules/custom_module
NOTE: for more information about multiple virtual hosts or the configuration
settings, consult http://drupal.org/getting-started/6/install/multi-site
For more information on configuring Drupal's file system path in a multisite
configuration, see step 6 above.
Drupal MultiSites
Each site configuration can have its own site-specific modules and themes in
addition to those installed in the standard 'modules' and 'themes' directories.
To use site-specific modules or themes, simply create a 'modules' or 'themes'
directory within the site configuration directory. For example, if
sub.example.com has a custom theme and a custom module that should not
be accessible to other sites, the setup would look like this:
sites/sub.example.com/
settings.php
themes/custom_theme
modules/custom_module
NOTE: for more information about multiple virtual hosts or the configuration
settings, consult http://drupal.org/getting-started/6/install/multi-site
For more information on configuring Drupal's file system path in a multisite
configuration, see step 6 above.
Drupal MultiSites
Drupal Multi-Site
Why?
●
For easy updating
●
Ease in setting up many sandboxes
●
Ease in trying out distros
Drupal Multi-Site
Drupal Multi-Site
A single Drupal installation can
host several Drupal-powered
sites, each with its own
individual configuration.
Outline of this talk
●
installing a local webserver
●
setting-up a local virtual host
●
setting-up several Drupal sites
Webserver
A computer software that could
make available data, info, files
for downloading by a web
browser, another computer
software.
Webserver
Tim Berners-Lee invented the first web
server software.
Webserver
Apache is
the most
used
webserver
Webserver
Webservers
most of the
time run in
Linux
machines.
Webserver
XAMPP is one
of the most
popular
portable
webserver
package.
Webserver
DEMO
Webserver
● Download a copy from
https://www.apachefriends.org/
● Read instructions available in
Apachefriends.
● Install
Outline of this talk
●
installing a local webserver
●
setting-up a local virtual host
●
setting-up several Drupal sites
Virtual Host
Advantages
●
Freedom to try out different domain names
●
Freedom to designate any folder as
DocumentRoot
●
Freedom to designate as many folder as
DocumentRoot
Virtual Host in XAMPP
1.“httpd-vhosts.conf” found in
Windows=>C:xamppapacheconfextra
Linux=>/opt/lampp/etc/extra/
2.“hosts” found in
Windows=>C:WindowsSystem32driversetc
Linux=>/etc/
Files to Edit
Virtual Host in XAMPP
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
httpd-vhosts.conf
Comment out (#) all the default text in the file and Input the following
right after the last commented line (#).
Virtual Host in XAMPP
<VirtualHost *:80>
DocumentRoot "C:Documents and SettingsjunabejoMy DocumentsDemosites"
ServerName demo.local
ServerAlias *.demo.local
<Directory "C:Documents and SettingsjunabejoMy DocumentsDemosites">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Allow from all
Require all granted
</Directory>
</VirtualHost>
httpd-vhosts.conf
Then, Input the following ...
Virtual Host in XAMPP
127.0.0.1 localhost
127.0.0.1 domainname.loc
127.0.0.1 domainname.local
127.0.0.1 domainname.dev
127.0.0.1 domainname.ass
127.0.0.1 domainname.build
127.0.0.1 subdomain1.domainname.loc
127.0.0.1 subdomain2.domainname.loc
127.0.0.1 subdomain3.domainname.loc
127.0.0.1 subdomain4.domainname.loc
127.0.0.1 subdomain5.domainname.loc
127.0.0.1 subdomain6.domainname.loc
hosts
Edit hosts file by adding all the local subdomain names you wanted to setup.
Examples of site names are as follows....
Virtual Host in XAMPP
After editing httpd-vhosts.conf and/or hosts,
restart webserver
●
Extract one Drupal package in your “DocumentRoot” of
the Virtual Host
●
Copy and rename “default” folder found in “sites” folder to
names of your local site-names
●
Change permission of “default” folder to writable by all or
chmod 777.
●
Read instructions in example.sites.php
●
Rename example.sites.php to sites.php
●
Edit accordingly sites.php
●
Input in sites.php all the site-names and aliases.
Drupal MultiSites
Drupal MultiSites
●
Run in the Browser URL box http://local-domain-
name/install.php to install a Drupal site.
Drupal MultiSites
DEMO
Drupal MultiSites
Thank you!
Jun Abejo
jun.abejo@gmail.com
Drupal MultiSites

Local Drupal MultiSite Set-up

  • 1.
    Drupal MultiSites Jun Abejo Site-Admin,http://fpdphils.org Education and Learning Specialist Foundations for People Dev, Inc. (FPD) Drupal User since 2008
  • 2.
    Instruction on MultisiteSet-up can be found in INSTALL.txt MULTISITE CONFIGURATION ----------------------- A single Drupal installation can host several Drupal-powered sites, each with its own individual configuration. Additional site configurations are created in subdirectories within the 'sites' directory. Each subdirectory must have a 'settings.php' file, which specifies the configuration settings. The easiest way to create additional sites is to copy the 'default' directory and modify the 'settings.php' file as appropriate. The new directory name is constructed from the site's URL. The configuration for www.example.com could be in 'sites/example.com/settings.php' (note that 'www.' should be omitted if users can access your site at http://example.com/). Drupal MultiSites
  • 3.
    Sites do nothave to have a different domain. You can also use subdomains and subdirectories for Drupal sites. For example, example.com, sub.example.com, and sub.example.com/site3 can all be defined as independent Drupal sites. The setup for a configuration such as this would look like the following: sites/default/settings.php sites/example.com/settings.php sites/sub.example.com/settings.php sites/sub.example.com.site3/settings.php When searching for a site configuration (for example www.sub.example.com/site3), Drupal will search for configuration files in the following order, using the first configuration it finds: Drupal MultiSites
  • 4.
    sites/www.sub.example.com.site3/settings.php sites/sub.example.com.site3/settings.php sites/example.com.site3/settings.php sites/www.sub.example.com/settings.php sites/sub.example.com/settings.php sites/example.com/settings.php sites/default/settings.php If you areinstalling on a non-standard port, the port number is treated as the deepest subdomain. For example: http://www.example.com:8080/ could be loaded from sites/8080.www.example.com/. The port number will be removed according to the pattern above if no port-specific configuration is found, just like a real subdomain. Drupal MultiSites
  • 5.
    Each site configurationcan have its own site-specific modules and themes in addition to those installed in the standard 'modules' and 'themes' directories. To use site-specific modules or themes, simply create a 'modules' or 'themes' directory within the site configuration directory. For example, if sub.example.com has a custom theme and a custom module that should not be accessible to other sites, the setup would look like this: sites/sub.example.com/ settings.php themes/custom_theme modules/custom_module NOTE: for more information about multiple virtual hosts or the configuration settings, consult http://drupal.org/getting-started/6/install/multi-site For more information on configuring Drupal's file system path in a multisite configuration, see step 6 above. Drupal MultiSites
  • 6.
    Each site configurationcan have its own site-specific modules and themes in addition to those installed in the standard 'modules' and 'themes' directories. To use site-specific modules or themes, simply create a 'modules' or 'themes' directory within the site configuration directory. For example, if sub.example.com has a custom theme and a custom module that should not be accessible to other sites, the setup would look like this: sites/sub.example.com/ settings.php themes/custom_theme modules/custom_module NOTE: for more information about multiple virtual hosts or the configuration settings, consult http://drupal.org/getting-started/6/install/multi-site For more information on configuring Drupal's file system path in a multisite configuration, see step 6 above. Drupal MultiSites
  • 7.
  • 8.
    Why? ● For easy updating ● Easein setting up many sandboxes ● Ease in trying out distros
  • 9.
  • 10.
    Drupal Multi-Site A singleDrupal installation can host several Drupal-powered sites, each with its own individual configuration.
  • 11.
    Outline of thistalk ● installing a local webserver ● setting-up a local virtual host ● setting-up several Drupal sites
  • 12.
    Webserver A computer softwarethat could make available data, info, files for downloading by a web browser, another computer software.
  • 13.
    Webserver Tim Berners-Lee inventedthe first web server software.
  • 14.
  • 15.
  • 16.
    Webserver XAMPP is one ofthe most popular portable webserver package.
  • 17.
  • 18.
    Webserver ● Download acopy from https://www.apachefriends.org/ ● Read instructions available in Apachefriends. ● Install
  • 19.
    Outline of thistalk ● installing a local webserver ● setting-up a local virtual host ● setting-up several Drupal sites
  • 20.
    Virtual Host Advantages ● Freedom totry out different domain names ● Freedom to designate any folder as DocumentRoot ● Freedom to designate as many folder as DocumentRoot
  • 21.
    Virtual Host inXAMPP 1.“httpd-vhosts.conf” found in Windows=>C:xamppapacheconfextra Linux=>/opt/lampp/etc/extra/ 2.“hosts” found in Windows=>C:WindowsSystem32driversetc Linux=>/etc/ Files to Edit
  • 22.
    Virtual Host inXAMPP NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs" ServerName localhost </VirtualHost> httpd-vhosts.conf Comment out (#) all the default text in the file and Input the following right after the last commented line (#).
  • 23.
    Virtual Host inXAMPP <VirtualHost *:80> DocumentRoot "C:Documents and SettingsjunabejoMy DocumentsDemosites" ServerName demo.local ServerAlias *.demo.local <Directory "C:Documents and SettingsjunabejoMy DocumentsDemosites"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Allow from all Require all granted </Directory> </VirtualHost> httpd-vhosts.conf Then, Input the following ...
  • 24.
    Virtual Host inXAMPP 127.0.0.1 localhost 127.0.0.1 domainname.loc 127.0.0.1 domainname.local 127.0.0.1 domainname.dev 127.0.0.1 domainname.ass 127.0.0.1 domainname.build 127.0.0.1 subdomain1.domainname.loc 127.0.0.1 subdomain2.domainname.loc 127.0.0.1 subdomain3.domainname.loc 127.0.0.1 subdomain4.domainname.loc 127.0.0.1 subdomain5.domainname.loc 127.0.0.1 subdomain6.domainname.loc hosts Edit hosts file by adding all the local subdomain names you wanted to setup. Examples of site names are as follows....
  • 25.
    Virtual Host inXAMPP After editing httpd-vhosts.conf and/or hosts, restart webserver
  • 26.
    ● Extract one Drupalpackage in your “DocumentRoot” of the Virtual Host ● Copy and rename “default” folder found in “sites” folder to names of your local site-names ● Change permission of “default” folder to writable by all or chmod 777. ● Read instructions in example.sites.php ● Rename example.sites.php to sites.php ● Edit accordingly sites.php ● Input in sites.php all the site-names and aliases. Drupal MultiSites
  • 27.
  • 28.
    ● Run in theBrowser URL box http://local-domain- name/install.php to install a Drupal site. Drupal MultiSites
  • 29.
  • 30.