Not a developer? Go to MovableType.com

Documentation

Managing multiple instances of Movable Type from a single installation

Some hosting providers and large companies wish to host multiple instances of Movable Type from a single source base. Each of these instances will have its own dedicated database. This allows for:

  • easier maintenance across all instances of Movable Type
  • faster upgrades across the system because files only need to be updated in one place
  • simpler plugin management because plugins are installed in only one place

In this scenario, each instance of Movable Type has its own mt-config.cgi file which defines the specific configuration properties for each instance of MT, including the database connection info.

How It Works

Movable Type looks first for specific environment variables to instruct itself on where to look for its core source code and configuration file. These environment variables are:

  • MT_HOME - this environment variable needs to point to the directory that contains your mt.cgi file and is used for constructing the search paths for your lib and extlib directories that contain all of Movable Type’s core source code. If this is not defined, then Movable Type will use the current work directory as the MT_HOME value.
  • MT_CONFIG - this environment variable points to the specific fully qualified path to a Movable Type configuration file. If this is not defined, then Movable Type will use $MT_HOME/mt-config.cgi as the path to the MT config file.

Important Note: Movable Type requires that all mt-config.cgi files that you maintain for your various instances of MT be located in the same directory. This is due to the fact that Movable Type deduces certain paths on the file system based upon the location of the instance’s mt-config.cgi file.

Setting up Apache

A single instance of Apache can be used to host websites under an unlimited number of domains. This is achieved through the use of Apache “virtual hosts.”

Each virtual host can have its own independent configuration and environment for processing web requests allowing system administrators to control each domain separately.

Example Configuration

The following example makes use of the following assumptions:

  • Movable Type is installed in /var/www/shared/cgi-bin/mt
  • Two web sites, site1.somedomain.com and site2.somedomain.com need to make use of the same Movable Type install, but have a separate database for each.
  • These two web sites each have their Movable Type configuration file. These files are located in /var/www/shared/conf.

This example uses the Apache mod_env module to point each instance of Movable Type to the same shared instance of Movable Type, but to different configuration files for each instance.

<VirtualHost *:80>
    ServerName site1.somedomain.com
    SetEnv MT_HOME /var/www/shared/cgi-bin/mt
    SetEnv MT_CONFIG /var/www/shared/conf/site1-mt-config.cgi
    ScriptAlias /cgi-bin/ /var/www/shared/cgi-bin/
    Alias /mt-static/ /var/www/shared/cgi-bin/mt-static/
</VirtualHost>
<VirtualHost *:80>
    ServerName site2.somedomain.com
    SetEnv MT_HOME /var/www/shared/cgi-bin/mt
    SetEnv MT_CONFIG /var/www/shared/conf/site2-mt-config.cgi
    ScriptAlias /cgi-bin/ /var/www/shared/cgi-bin/
    Alias /mt-static/ /var/www/shared/cgi-bin/mt/mt-static/
</VirtualHost>

In the above example, Movable Type can be accessed at the following URLs:

  • http://site1.somedomain.com/cgi-bin/mt/mt.cgi
  • http://site2.somedomain.com/cgi-bin/mt/mt.cgi

See Also

Warning: Installing multiple instances of Movable Type may be in violation of your license, if you are an enterprise of commercial customer.

Back

5 Comments

Shanx

Shanx on February 6, 2008, 12:07 p.m. Reply

Hi. Please clarify what the “/path/to/mt” is. In a setting where each domain user (virtual host) is restricted to its own “/home” directory using Opendir protection for Apache for example, this may or may not be as straightfwd as it sounds in this manual entry.

Please advise with real world scenarios. For example:

  1. root.com is my main root domain.

  2. domain1.com and domain2.com are my two domains running on the same Apache as root domain but as different virtual hosts.

  3. I install MT in http://root.com/mt/

  4. Now how do I make it available from domain1.com and domain2.com?

Thanks.

Byrne Reese

Byrne Reese on February 6, 2008, 12:47 p.m. Reply

The /path/to/mt path always refers to the fully qualified and absolute file path on your Web server where the mt.cgi file can be found. That is your MT_HOME directory. One way to determine what the path to this directory (when accessing your server via shell) is to navigate to the directory containing mt.cgi and to execute the command pwd. The output will show you to complete path to your current working directory. If you are using an FTP client, it to should be able to show you your current working directory. This path is a directory structure and usually starts with a “/”.

shanx.myopenid.com

shanx.myopenid.com on February 16, 2008, 6:49 a.m. Reply

Thanks Bryan. I guess my question was whether this MT_HOME has to be the host domain (in a dedicated server setting) or can it be any of the VirtualHost domains, so long as the paths are correctly specified?

My fear is that this recommended setup may not work with something like OpenDir protection, where VirtualHost1 is not allowed to navigate the directory of VirtualHost2 — as is customary in good stealth shared hosting environments.

As such, would we need to install MT in the root host folder, and then allow access from different domains? And if so, what’re the permissions/grants needed.

Possibly a silly question but hopefully relevant to many dedicated hosting providers.

Quinn Gittings

Quinn Gittings on June 8, 2009, 9:07 p.m. Reply

How do I setup my MT blog to be accessible on my domain root? e.g. when you navigate to domain.com instead of domain.com/mt/mt.cgi?

1001bonnesaffaires

1001bonnesaffaires on October 14, 2012, 10:56 a.m. Reply

I want to create a development environment running Movable Type 5. To create a separate development environment, it is necessary to copy and paste to reflect production. How would I go about building a good environment?

Leave a Comment