Local Drupal MultiSite Set-up

Post on 26-May-2015

316 views 3 download

Tags:

description

A slide presentation for local Drupal multi-site set-up. This is for beginners wishing to learn more about Drupal and want to try it in their local PCs, Windows or Linux.

Transcript of Local Drupal MultiSite Set-up

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

specifiesthe configuration settings. The easiest way to create additional sites is tocopy 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 inWindows=>C:\xampp\apache\conf\extra\Linux=>/opt/lampp/etc/extra/

2.“hosts” found inWindows=>C:\Windows\System32\drivers\etc\Linux=>/etc/

Files to Edit

Virtual Host in XAMPP

NameVirtualHost *:80

<VirtualHost *:80> DocumentRoot "C:/xampp/htdocs" ServerName localhost</VirtualHost>

httpd-vhosts.confComment 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 Settings\junabejo\My Documents\Demosites" ServerName demo.local ServerAlias *.demo.local <Directory "C:Documents and Settings\junabejo\My Documents\Demosites"> 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 localhost127.0.0.1 domainname.loc127.0.0.1 domainname.local127.0.0.1 domainname.dev127.0.0.1 domainname.ass127.0.0.1 domainname.build127.0.0.1 subdomain1.domainname.loc127.0.0.1 subdomain2.domainname.loc127.0.0.1 subdomain3.domainname.loc127.0.0.1 subdomain4.domainname.loc127.0.0.1 subdomain5.domainname.loc127.0.0.1 subdomain6.domainname.loc

hostsEdit 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 Abejojun.abejo@gmail.com

Drupal MultiSites