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.
Python Paste