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 yourmt.cgifile and is used for constructing the search paths for yourlibandextlibdirectories 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.cgias 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
- VirtualHost documentation
- mod_env module documentation
Warning: Installing multiple instances of Movable Type may be in violation of your license, if you are an enterprise of commercial customer.