<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Drinkingbird: Category Typo</title>
    <link>http://www.drinkingbird.net/blog/articles/category/site5</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Random keyboard peckings</description>
    <item>
      <title>Fix the Apache trailing slash problem</title>
      <description>&lt;p&gt;After a lot of stuffing about I finally found a solution to the problem that I was having with the URL for this blog.&lt;/p&gt;

&lt;p&gt;The basic problem was that the link http://www.drinkingbird.net/blog (without the trailing slash) was being rejected with a &lt;code&gt;400 Bad Request&lt;/code&gt; error.&lt;/p&gt;

&lt;p&gt;I spent ages trying to get this to work with awkward rewrite rules in the parent directory, when I should have been looking in the public directory of the rails app. The solution is well enough explained over at &lt;a href="http://www.lavafactory.com/articles/2006/09/27/how-to-fix-the-trailing-slash-problem-with-apache-rails"&gt;LavaFactory&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I just made one small refinement, which is to change:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;RewriteRule .*/blog/(.*) http://www.drinkingbird.net/blog/$1 [L,R]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;to&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;RewriteRule (.*)/blog/(.*) $1/blog/$2&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;to satisfy my relentless desire to avoid configuration tied to a particular domain.&lt;/p&gt;</description>
      <pubDate>Sun, 17 Jun 2007 05:48:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:5f8e6bb8-4051-4087-92d6-cc9708c077ac</guid>
      <author>Chris</author>
      <link>http://www.drinkingbird.net/blog/articles/2007/06/17/fix-the-apache-trailing-slash-problem</link>
      <category>Typo</category>
      <category>Ruby on Rails</category>
    </item>
    <item>
      <title>Typo on Site5</title>
      <description>&lt;p&gt;I thought I&amp;#8217;d post a quick summary on what I went through to get Typo up and running on &lt;a href="http://www.site5.com"&gt;Site5&lt;/a&gt;, since it&amp;#8217;s a bit more tricky now that the SiteAdmin interface no longer contains an automatic install script.&lt;/p&gt;

&lt;p&gt;I decided to go the gem route on this, so that&amp;#8217;s the only way I&amp;#8217;m going to talk about. If you want to install from SVN trunk, you&amp;#8217;re on your own.&lt;/p&gt;

&lt;p&gt;First, you&amp;#8217;ll want to set up your account with a local gem installation directory, as detailed in this &lt;a href="http://forums.site5.com/showthread.php?t=11954"&gt;forum thread&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Then, ssh into your account (if you&amp;#8217;re not still there), and type:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;gem install typo&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;There&amp;#8217;s a good chance this will fail the first time, with an error on attempting to install the sqlite3-ruby gem. This can be solved by opening a ticket with Site5&amp;#8217;s support, and asking to have the sqlite-devel package installed on your server, then trying again.&lt;/p&gt;

&lt;p&gt;Once the gem is installed, you just need to run&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;typo &amp;lt;installation directory&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt; then manually kill the mongrel process it spaws immediately after installation (I&amp;#8217;d lay money on site5&amp;#8217;s servers doing this automatically if you don&amp;#8217;t anyway).

From here, it&amp;#8217;s all fairly easy:

Edit the environment.rb file in typo&amp;#8217;s config directory, and uncomment the line:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="constant"&gt;ENV&lt;/span&gt;&lt;span class="punct"&gt;['&lt;/span&gt;&lt;span class="string"&gt;RAILS_ENV&lt;/span&gt;&lt;span class="punct"&gt;']&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;production&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;and add the line:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="constant"&gt;ENV&lt;/span&gt;&lt;span class="punct"&gt;['&lt;/span&gt;&lt;span class="string"&gt;GEM_PATH&lt;/span&gt;&lt;span class="punct"&gt;']&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;/home/&amp;lt;your_username&amp;gt;/&amp;lt;path_to_gems&amp;gt;:/usr/lib/ruby/gems/1.8&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Create the file public/.htaccess in the typo directory as:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;# General Apache options
AddHandler fastcgi-script .fcgi
Options +FollowSymLinks +ExecCGI

RewriteEngine On

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

ErrorDocument 500 /500.html # You may want to edit this file&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Setup a mysql database for the blog&amp;#8217;s production db, and configure it in config/database.yml. Example config:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_yaml "&gt;&lt;span class="key"&gt;production&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt;
  &lt;span class="key"&gt;adapter&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt; mysql
  &lt;span class="key"&gt;database&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt; username_blog
  &lt;span class="key"&gt;username&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt; username_blog
  &lt;span class="key"&gt;password&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt; secret
  &lt;span class="key"&gt;host&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt; localhost&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Then run &lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;rake db:migrate RAILS_ENV=production&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;to load the schema.&lt;/p&gt;

&lt;p&gt;If you installed your blog anywhere other than under your public_html directory, you&amp;#8217;ll need to create a symlink to the blog, e.g.&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;ln -s /path/to/typo/public public_html/blog&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Hopefully this ends up helping someone. If not, well at least it gave me an excuse to get to grips with some of typo&amp;#8217;s editing syntax. If I&amp;#8217;ve missed anything, please bitch at me, so I can fix it.&lt;/p&gt;</description>
      <pubDate>Sun, 10 Jun 2007 06:51:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:6d4ddb74-99b7-429e-b270-0433e34019e9</guid>
      <author>Chris</author>
      <link>http://www.drinkingbird.net/blog/articles/2007/06/10/typo-on-site5</link>
      <category>Typo</category>
      <category>Ruby on Rails</category>
    </item>
  </channel>
</rss>
