Nginx setup (in
/etc/nginx/sites-available/blog.johnp.net):
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;
# Common include & image files.
location ^~ /i/ {
alias /home/www/i/;
}
location ^~ /images/ {
alias /home/www/images/;
}
# There are only two non-blog URIs to worry about.
location = /favicon.ico {
alias /home/www/blog.johnp.net/htdocs/favicon.ico;
}
location = /robots.txt {
alias /home/www/blog.johnp.net/htdocs/robots.txt;
}
# Pass all other URLs to PyBlosxom running under Paste.
location ~ / {
fastcgi_pass localhost:4999;
fastcgi_param PATH_INFO $request_uri;
include fastcgi_params;
}
}
My little server is running Ubuntu, which has
/etc/nginx/fastcgi_params for all the "standard" CGI
variables. But PyBlosxom wanted
PATH_INFO as well.
Python Paste setup (in /home/john/blog/etc/blog.ini):
#!/usr/bin/env paster
[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
Unfortunately the "executable shell script" stuff mentioned in the
docs doesn't work too
well for me (which it does warn you about), so I've wrapped the
paste serve invocation into a short script:
#!/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) 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 \ $* # End of serve-blog.sh
I have added this script to my rc.local to run at boot time.
Relevant bits of my PyBlosxom setup (in /etc/pyblosxom/config.py):
# 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
#
[snip]
py["datadir"] = "/home/john/blog/entries" py["logdir"] = "/home/john/blog/log" # This doesn't seem to be used... py["log_file"] = "/home/john/blog/log/pyblosxom.log" py["log_level"] = "warning" # The next two lines were good when debugging my archives plugin. #py["log_level"] = "debug" #py["renderer"] = "debug" 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"
This is not the complete setup, but it has the interesting stuff. I
copied the default HTML flavour files (content_type.html,
date_head.html, foot.html,
head.html, and story.html) into
/home/john/blog/flavours/html.flav/ for tweaking.
Hopefully someone will find this useful.
Emboldened by my success in writing an archives plugin, I'd now like to do one for my blog categories and another to suck down my recent Delicious link posts.
I'd also like to re-do the layout so it doesn't look so primitive. I was reading a post on Peter Seibel's blog the other day, and his layout & HTML source looked pretty good, so I might do something based on that.
But none of these things are particularly urgent, so I think I'll move on to trying to get ABCL running on the Google App Engine (after having spent a fair bit of time getting JDEE and its dependencies set up in Emacs). But I do intend to do a post on my Nginx/Paste/PyBlosxom setup.
And now, having finished this post, it's time to go to bed.
Well, I've finally got around to moving this blog to PyBlosxom. I've written my own plugin to generate the archives at the top of the page; I'm also now running on Nginx as a web server, which talks to Python Paste via FastCGI. So the blog is now dynamically generated. The next thing is to try and integrate the Disqus comments plugin.
The other thing I need to do is move the rest of my personal site(s) to this server.
I have lots of things I'd like to blog about; it's great to finally have this sorted out.
And yes, it's been another very busy year. Since my last post my third child was born (Hi Theo!), my oldest has started school (Hi Bethany!) and we've moved half-way around the world for a while... so stay tuned for more news (OK, maybe "news" is the wrong word).
Python Paste