Typo
Posted by Hans Fugal
I am in the process of migrating my blog to Typo. Blosxom has served me well, but I think it's time I joined the ranks of cool blogs and allowed people to comment, trackback, etc. Blosxom can do all that, but it's not very much fun.
Blosxom's strength is its simplicity. When I wanted a simple blog, it was perfect.
Now, getting typo to work was not a walk in the park. I'll walk you through what I had to do.
First, you have to get typo and install it. I hear rumors that version 4 release is imminent, so I grabbed the svn version. Next, make a database and set up config/database.yml. Now you can run script/server -e production and point your browser at http://localhost:3000/ and give it a whirl.
I tried the RSS and atom converters in db/converters but I wasn't satisfied with the results. So I wrote a blosxom converter, which I will contribute. If you can't find it feel free to contact me.
The hard part was getting typo to run under a subdirectory in my mixed apache/lighttpd setup. All fugal.net sites are running through Apache. My rails apps run through lighttpd, with apache's mod_proxy. So, you have to configure apache, lighttpd, and rails each in turn.
Apache Configuration
ProxyPass /typo http://127.0.0.1:81/typo
ProxyPassReverse /typo http://127.0.0.1:81/typo
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
Lighttpd Configuration
The normal lighttpd stuff, and then:
$HTTP["url"] =~ "^/typo(/|$)" {
server.indexfiles = ("dispatch.fcgi")
server.document-root = "/srv/www/typo/public/"
server.error-handler-404 = "/dispatch.fcgi"
server.errorlog = "/srv/www/typo/log/error.log"
accesslog.filename = "/srv/www/typo/log/access.log"
fastcgi.server = ( ".fcgi" => (
"typo" => ( "min-procs" => 1, "max-procs" => 1,
"socket" => "/tmp/typo.fcgi.socket",
"bin-path" => "/srv/www/typo/public/dispatch.fcgi",
"bin-environment" => ( "RAILS_ENV" => "production" ),
"idle-timeout" => 120
)
)
)
}
You don't need strip-request-uri, because we'll take care of the typo/ prefix in rails.
Rails Config
Add this to config/environment.rb:
ActionController::AbstractRequest.relative_url_root = "/typo"
Finally, and this was the real stink, you have to help lighttpd find files in public/. Lighttpd gets a request for http://hans.fugal.net/typo/foo.html which is a static file in public/, and so it looks in the document root to find /typo/foo.html, which means it looks for /srv/www/typo/public/typo/foo.html, which doesn't exist. This is easy to fix:
cd /srv/www/typo/public
ln -s . typo
et voilá! You should be up and running.
For more reading see http://znark.com/blog/articles/2005/12/11/got-typo-working and http://blog.lighttpd.net/articles/2005/11/23/lighttpd-1-4-8-and-multiple-rails-apps.

Great pointers!
One thing though, you don't need that symlink in the last step... just be sure to include mod_alias in lighttpd and then just do:
alias.url = ( "/typo" => "/srv/www/typo/public" )Actually Tim, it should be:
alias.url = ( "/typo/" => "/srv/www/typo/public/" )
:D
Thanks for this post. The information saved me some time :)