Marko Anastasov wrote this on March 15, 2010
Recently we needed to deploy a site made with Textpattern CMS by our friends from Sprawsm, along with a forum app that we built with Rails. The scenario is that a designer develops a web site locally in his Coda or similar environment, and hands it to you archived with a filled config.php a database that is ready to be imported on the server. We wanted to set the site up as a virtual host.
It wasn’t that quick and easy, as deploying a Textpattern site is basically a nonexistent term. Instead, it is usually just uploaded via FTP to a shared host. Searching for a sample VirtualHost configuration led me to the Textpattern Multi-Site Howto, which is quite noisy and suggests that you point your DocumentRoot to a subdirectory in
sites/. It includes pieces such as [Textpattern will tell you to place your config.php file in /textpattern/. This is INCORRECT.[ and [it will present a link to the [main interface.[ This link will be INCORRECT, so do not click it[. Ignore that guide. In fact, remove the
sites directory, unless you do have multiple Textpattern sites and you’re absolutely sure that you want to save a couple of kilobytes of PHP source code at the cost of getting lost in configuration.
This is what works for us:
/var/tpapp$ rm -rf sites
<VirtualHost *:80> ServerName tpapp.com ServerAlias www.tpapp.com DocumentRoot /var/tpapp <Directory [/var/tpapp[> Options +FollowSymLinks </Directory> </VirtualHost>
<?php $txpcfg['db'] = 'tpapp_db_name'; $txpcfg['user'] = 'root'; $txpcfg['pass'] = 'rootpassword'; $txpcfg['host'] = 'localhost'; $txpcfg['table_prefix'] = ''; $txpcfg['txpath'] = '/var/tpapp/textpattern'; $txpcfg['dbcharset'] = 'utf8'; define('txpath', $txpcfg['txpath']); ?>
By the way, on Ubuntu the easiest way to get all the dependencies quickly is to install the Textpattern package, and then manually create the target database:
apt-get install textpattern
Textpattern has a screen to diagnose possible issues which you can access at
/textpattern/index.php?event=diag. For example, you might’ve forgotten to enable mod_rewrite (via
sudo a2enmod) on a fresh server image, or fix some simple permission errors.