Create multiple Drupal sites from a single code base and multiple databases

Source: Internet
Author: User
Tags file system ftp client drupal multisite mysql database root directory advantage

There are many reasons for a system administrator or developer to choose to host multiple sites on the same server with a multisite configuration. For example, the following configuration:

Enables you to build an efficient development environment

Allows you to temporarily save and test it before exposing the site

Allow different software to run on the same site

Supports sharing a single code base across multiple sites

Leveraging a shared managed host

Allows similar security to be run on the same server (HTTP [HTTPS] based on Secure Sockets Layer) and standard (HTTP) sites

Simplify Server Management

However, not all of these reasons can be best handled through Drupal's multi-site features. This article focuses on a strategy: How to make Drupal's built-in multi-site support create and deliver multiple sites in a single Drupal instance.

Basic factors to consider

Creating a multi-site configuration with the Drupal Content Management System (CMS) has several distinct advantages, one of which is the configuration that it may be easiest to set up and maintain. Another advantage is that the data repeat rate is minimized because Drupal is installed only in a location on the server. Finally, Drupal has a wealth of contribution modules that can be used to refine multi-site processing and provide advanced functionality to all sites in the layout. With new features and simplified management, anyone who wants to set up and manage a multi-site layout can benefit from it. However, there are some drawbacks to using this configuration, and two of these are particularly noteworthy: security and sharing.

Sites in a multi-site installation share the same code, which in turn shares the same files. As a result, for anyone who has access to the file system of a site on a server, he can access files for all sites on that multisite installation. Therefore, it may not be safe for different people to manage different sites in the layout. If security between sites is a major problem, or if different people manage different sites, Drupal's built-in multi-site functionality may not be the best solution. Instead, consider providing your own different Drupal instances for each site. While the advantages of a multi-site layout that are easier to manage will be lost, your site can be more effective at avoiding surprises.

The second problem (sharing) is closely related to database access. Although multiple sites of Drupal can share the same source code, they do not share the same database data. Therefore, by default, nodes, users, and comments in a site cannot be accessed from other sites. This behavior can actually be viewed as an advantage, but this may be reflected in the lack of design for Drupal's multisite features in situations where administrators may need all site sharing information. In any case, the best balance of Drupal's built-in multi-site support is that modules, themes, and uploaded files can be shared across all sites. In addition, the same or custom files can be kept in different folders that correspond to different sites that are configured. If it is important to share everything, consider using a multi-domain feature that can easily be implemented through a module of the same name.

Install Drupal for multi-site

After you download the Drupal compressed file, unzip the file and copy the resulting folder to the Web server's document root directory. With the appropriate FTP client, this task is easy to complete, and this task is easier to complete when using the server's secure Shell (SSH) method. Run the wget command to download the compressed file from the repository, extract the file, and build the Drupal installation folder. (If the development environment is local, more options are supported.) )。 Name the installation folder/goodsite.

We'll create 3 different sites for this exercise, so we need 3 different databases and one database for one site. This task is easy to complete if you use the Cpanel phpMyAdmin from the server. Next, install the framework. However, before you run Setup using a Web browser, you must perform two tasks:

Provide Drupal with information about the site you want to run.

Delivers site-specific configuration data from Drupal to all sites.

To complete the first task, you need to create a special directory for each site. For the second task, you can find one of the settings files in each directory. The purpose is to set up a master installation that contains two subwebs. Each subweb shares the same files as the core, but each subweb has its own separate URL and database. The URL to create a site for is:

Main site: http://goodsite.com

Sub-site 1:http://bettersite.com

Sub-site 2:http://bestsite.com

Installing the first host

After you place the Drupal source code under the document root and create the MySQL database, you can begin installing the first site and primary domain.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.