Further to my post about getting the MoinMoin wiki system working with FastCGI and Lighttpd, here is how to do the same with NGINX. MoinMoin is configured in FastCGI mode and listening on port 9005
All the fastcgi_param
lines up to PATH_INFO
are pretty generic and I have them in a separate include file that I pull in for any Fastcgi stanza.
if ($uri ~ ^/wiki(.*)?) {
set $wiki_url $1;
}
location /wiki {
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param PATH_INFO $wiki_url;
fastcgi_param SCRIPT_NAME /wiki;
if (!-f $request_filename) {
fastcgi_pass 127.0.0.1:9005;
}
}
Comments
theres another way, at least with moinmoin 1.8+, you only need:
location /wiki {
fastcgi_param HTTP_X_MOIN_LOCATION /wiki;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_pass 127.0.0.1:9005;
}
@David:
Nginx gave me errors about SERVER_NAME, SERVER_PORT, and SERVER_PROTOCOL not being defined. It still seemed to work fine without, but I added them anyway to stop the log spam.
[…] From John Leach […]
[…] MoinMoin wiki on NGINX […]
Nice guide… ever tried uwsgi?
I’ve been trying that but can’t seem to get the URLs right… I’ve tried:
uwsgi_param SCRIPT_NAME /wiki;
but still all URLs are in /