<?xml version="1.0" encoding="utf8" ?>
<rss version="2.0" 
   xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" 
   xmlns:html="http://www.w3.org/1999/html" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
   <title>No Warranty Expressed Or Implied</title>
   <link>http://johnp.net/blog</link>
   <description>Lisp, synthesisers, Web 3D &amp; stuff.</description>
   <language>en</language>
   <copyright>Copyright &#00a9; 2011 John Pallister</copyright>
   <ttl>60</ttl>
   <pubDate>Wed, 14 Oct 2009 12:08 GMT</pubDate>
   <managingEditor>me@johnp.net</managingEditor>
   <generator>PyBlosxom http://pyblosxom.sourceforge.net/ 1.4.3 01/10/2008</generator>
<item>
   <title>Blog site setup</title>
   <guid isPermaLink="false">sites/blog-site-setup</guid>
   <link>http://johnp.net/blog/sites/blog-site-setup.html</link>
   <description><![CDATA[

<p><a href="http://nginx.net/">Nginx</a> setup (in
<code>/etc/nginx/sites-available/blog.johnp.net</code>):</p>

<pre>server {
    listen      80;
    server_name blog.johnp.net;
    access_log  /home/www/blog.johnp.net/log/access.log;
    error_log   /home/www/blog.johnp.net/log/error.log;

    <span class="comment"># Common include &amp; image files.</span>
    location ^~ /i/ {
        alias   /home/www/i/;
    }
    location ^~ /images/ {
        alias   /home/www/images/;
    }
    <span class="comment"># There are only two non-blog URIs to worry about.</span>
    location = /favicon.ico {
        alias   /home/www/blog.johnp.net/htdocs/favicon.ico;
    }
    location = /robots.txt {
        alias   /home/www/blog.johnp.net/htdocs/robots.txt;
    }
    <span class="comment"># Pass all other URLs to PyBlosxom running under Paste.</span>
    location ~ / {
        fastcgi_pass    localhost:4999;
        fastcgi_param   PATH_INFO $request_uri;
        include         fastcgi_params;
    }
}</pre>

<p>My little server is running <a
href="http://ubuntu.com/">Ubuntu</a>, which has
<code>/etc/nginx/fastcgi_params</code> for all the "standard" CGI
variables. But <a
href="http://pyblosxom.sourceforge.net/">PyBlosxom</a> wanted
<code>PATH_INFO</code> as well.</p>

<p><a href="http://pythonpaste.org/">Python Paste</a> setup (in <code>/home/john/blog/etc/blog.ini</code>):</p>

<pre><span class="comment">#!/usr/bin/env paster</span>
[default]
debug = false

[exe]
command = serve
daemon = true
reload = true
reload-interval = 120
monitor-restart = true
pid-file = /home/john/blog/etc/paster.pid
log-file = /home/john/blog/log/paster.log

[server:main]
use = egg:Flup#fcgi_thread
host = 127.0.0.1
port = 4999

[app:main]
paste.app_factory = Pyblosxom.pyblosxom:pyblosxom_app_factory
configpydir = /etc/pyblosxom</pre>

<p>Unfortunately the "executable shell script" stuff mentioned in the
<a href="http://pythonpaste.org/script/">docs</a> doesn't work too
well for me (which it does warn you about), so I've wrapped the
<code>paste serve</code> invocation into a short script:</p>

<pre><span class="comment">#!/bin/bash
# serve-blog.sh - Run Python Paste to serve my PyBlosxom blog.
# File Created: 14 October 2009
# Author: John Pallister (mailto:john@synchromesh.com)</span>

CONFIG_FILE=/home/john/blog/etc/blog.ini

/usr/bin/paster serve --daemon \
    --reload \
    --reload-interval=120 \
    --monitor-restart \
    --pid-file=/home/john/blog/etc/paster.pid \
    --log-file=/home/john/blog/log/paster.log \
    $CONFIG_FILE \
    $*

<span class="comment"># End of serve-blog.sh</span></pre>

<p>I have added this script to my <code>rc.local</code> to run at boot time.</p>

<p>Relevant bits of my PyBlosxom setup (in <code>/etc/pyblosxom/config.py</code>):</p>

<pre><span class="comment"># 2 Oct 09 JDP Note: I have modified /usr/share/python-support/pyblosxom/Pyblosxom/pyblosxom.py
# to read '.blog' files instead of '.txt' files.
#
# Unused variables:
#   renderer
#   default_flavour
#</span></pre>
<i>[snip]</i>
<pre>py["datadir"] = "/home/john/blog/entries"

py["logdir"] = "/home/john/blog/log" <span class="comment"># This doesn't seem to be used...</span>
py["log_file"] = "/home/john/blog/log/pyblosxom.log"

py["log_level"] = "warning"
<span class="comment"># The next two lines were good when debugging my archives plugin.
#py["log_level"] = "debug"
#py["renderer"] = "debug"</span>

py["base_url"] = "http://blog.johnp.net"

py["flavourdir"] = "/home/john/blog/flavours"

py["plugin_dirs"] = ["/etc/pyblosxom/plugins", "/home/john/blog/plugins"]
py["load_plugins"] = ["disqus", "myarchives"]

py["cacheDriver"] = "entrypickle"
py["cacheConfig"] = "/var/run/pyblosxom-cache"
</pre>

<p>This is not the complete setup, but it has the interesting stuff. I
copied the default HTML flavour files (<code>content_type.html</code>,
<code>date_head.html</code>, <code>foot.html</code>,
<code>head.html</code>, and <code>story.html</code>) into
<code>/home/john/blog/flavours/html.flav/</code> for tweaking.</p>

<p>Hopefully someone will find this useful.</p>
]]></description>
   <category domain="http://johnp.net/blog"></category>
   <pubDate>Wed, 14 Oct 2009 12:08 GMT</pubDate>
</item>
</channel>
</rss>

