# Typo Install Problems

So, a non-obvious problem getting typo working: my first effort at getting it running off Apache’s CGI mode was confounded my two mysterious problems: one turned out to be with the RAILS_ENV setting, and the other was with symlinks.

Both turned out to be pretty straightforward, but there was a certain amount of cursing working out what was going on, since both just gave the useless “Cannot connect to typo” error, and left nothing in either the typo or Apache error logs.

Since typo is the first Rails app I’ve worked with I wasn’t aware of the RAILS_ENV environment variable; when I set up typo I only bothered to configure a production DB. This works fine when you fire up the bundled WebBrick HTTP server (where you spec the environment with a runtime option), but as soon as you hook up Apache CGI it starts running in development by default. There are a number of possible fixes for this, but I went for the simple solution of editing the config/environment.rb to make “production” the default value.

The other problem was a bit more subtle and annoying. Since I have an old site under ~/public_html that’s published via mod_userdir that I want to preserve, I planned on having typo’s public/ folder act as the new root for my home directory, and drop all my old content in there. I naively symlinked ~/public_html to typo/public/.

After much swearing and cursing I realised what ought to have been obvious given, oh, 5 seconds thought: since the dispatch.cgi and dispatch.fcgi reference their parent directory, this is a dumb idea. Because the symlink’s parent is nowhere near the typo root. Oops.

Overriding the normal mod_userdir with:

 Alias /~rodgerd/ /my/home/dir/typo-root/public 

…works fabulously, though.

Share