twisted moinmion with nginx proxy
This brief how to covers getting nginx to proxy to a MoinMoin install running with the twisted back-end.
Nginx configuration settings. I wanted to to have nginx act as a proxy front-end for a MoinMoin instance, running with twisted. This is the nginx section that I used. The URL for accessing the Moin instance is
http://domain.com/moin/.
This config is under the server config section.location /moin/ { proxy_redirect http://localhost:8080/ /; proxy_pass http://localhost:8080/; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Moin-Location /moin/; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; }The real magic is in the X-Moin-Location header. That tells Moin to add that path to the links in the output. Sadly, it took me a while to find that.
Moin configuration settings.
I am running Moin under the twisted framework. The Moin setup is pretty standard. The Moin wiki contains good information on setting up this part of it -- Moin Wiki Twisted.
Miscellaneous
I encountered one problem. The /wiki directory is where the image, css, and other static files are located. Moin wasn't adding the header to those URLs for some reason. So, I just copied those data files, from
/usr/share/moin/wiki/htdocs, to the /wiki directory of my nginx webserver. Having the webserver handle these static files directly, is quite a bit faster anyway.