the further adventures of

Mike Pirnat

a leaf on the wind

« Previous Post Next Post »

In Which Apache Reverse Proxies for Twisted Running MoinMoin

I'm posting this more to remember how the heck I got it working than to be any sort of definitive reference. But some folks might find it useful...

In /etc/portage/package.keywords:

www-apps/moinmoin ~x86
www-apache/mod_proxy_html ~x86
dev-libs/libxml2 ~x86

Emerge stuff:

emerge apache2
emerge moinmoin
emerge libxml2
emerge mod_proxy_html
emerge twisted

Read a bit of Apache Week's excellent and helpful article on running a reverse proxy on Apache. Admire its usefulness.

In /etc/conf.d/apache2:


(plus whatever you would have had otherwise)

In /etc/apache2/httpd.conf:

<IfDefine PROXY>
    LoadModule proxy_module                  modules/
    LoadModule proxy_connect_module          modules/
    LoadModule proxy_ftp_module              modules/
    LoadModule proxy_http_module             modules/
    LoadFile   /usr/lib/
    LoadModule proxy_html_module             modules/

In /etc/apache2/vhosts.d/

<VirtualHost *:80>
    ProxyPass / http://localhost:8081/

I chose to run the twisted server on 8081 because I want to play with TurboGears in the coming days, and its standalone server likes to run on 8080 by default, which is also where twistd wants to run by default. I'd rather have the next "new guy" running on its default as I play with it; that should make life slightly easier.

Follow instructions on creating a wiki instance.

Follow instructions on running Moin behind a Twisted server. Edit the to have the twistd server listen on the port specified in the file in vhosts.d (in this case 8081).

Drop a nice little init.d script into /etc/init.d/mywiki:

# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: $

depend() {
        after net

start() {
        ebegin "Starting MyWiki (twistd)"
        /usr/share/moin/mywiki/mointwisted start
        eend $? "Failed to start MyWiki (twistd)"

stop() {
        ebegin "Stopping MyWiki (twistd)"
        /usr/share/moin/mywiki/mointwisted stop
        eend $? "Failed to stop MyWiki (twistd)"

Fire up the twistd server using the init.d script; connect to http://localhost:8081/ to verify that the wiki itself is running. Fire up apache and connect to to verify that the reverse proxy magic is happening correctly.


blog comments powered by Disqus

« Previous Post Next Post »