Long time since last post here. Yeah, I’m alive.
For wiking with moin on nginx, I tried a lot and finally got it work. I’m using Moin 1.7.2 with Nginx 0.7.19 on Slackware linux.
As you may know, there is a mod called mod_wsgi which is an implementation of the Python Web Server Gateway Interface for the nginx web server. However, mod_wsgi code is about 7 months old and only tested with nginx 0.5.x, currently cannot be built with nginx 0.7.x. I didn’t test it with nginx 0.6.x, but there are some patches. For more information, check http://hg.mperillo.ath.cx/nginx/mod_wsgi/file/tip/README (CANNOT access from m^therf^cking China mainland network).
I intended to use the public wiki mode, but unfortunately, haven’t work it out on fastcgi. Any help is welcome. :-)
It was Cliff who illumined me that nginx can proxy to moin standalone server. Thanks to Cliff.
After some test, here is a block of the working nginx configuration on moinmoin wiki.
...snip...
server {
listen 127.0.0.1:80;
server_name localhost;
server_tokens off;
root /srv;
# Begin Core MoinMoin:
rewrite ^/moin_static[0-9]+/(.*)$ /moin/$1 last;
rewrite ^/(favicon\.ico)$ /moin/$1 last;
### temporary use
location = / {
rewrite .* /wiki/ redirect;
}
###
location /wiki {
proxy_redirect http://localhost:8000 /;
proxy_pass http://localhost:8000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Moin-Location /wiki/;
}
# End Core MoinMoin.
location ~* \.(jpg|jpeg|gif|png|ico|css|js|txt)$ {
access_log off;
expires 30d;
}
location ~* /\.ht {
deny all;
}
}
...snip...
Then, http://localhost/wiki is ready.
It’s an important point of the X-Moin-Location header. Moin will add that path to the output link.
So far, so good.
Successfully upgraded Moin from 1.7.2 to 1.8.0 just now.
Nothing special. Take care.
Hi Li,
I just switched the Nginx wiki from the Moin standalone server to using the Twisted server. It seems to handle load better and seems to use a bit less memory as well.
Getting it up was pretty easy:
1. Install Twisted (might be available as a package for your system, but if not, I recommend using easy_install).
2. Copy the files mointwisted and mointwisted.py to the directory where you normally launch moin from.
3. Edit mointwisted and change any settings you need to in there (pretty much the same as you changed the “moin” file).
The only problem I need to work out is that when proxying from Nginx links get emailed and include the port. I need to figure out what environment variable Twisted looks at (e.g. X_Forwarded_For) for getting proxy settings.
Still, I’d recommend trying it out.
Hi Cliff,
you gave me a surprise, as the xmas present, right? lol
Thanks a lot for sharing. I’ll try it out when I get time.
Have a good day and happy new year.
The correct writing of rules will be the following (from Igor Sysoev)
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Moin-Location /wiki/;
location = / {
proxy_pass http://localhost:8000/wiki/;
proxy_redirect http://localhost:8000/ /;
}
location /wiki {
proxy_pass http://localhost:8000;
}
location /moin_static {
location ~ ^/moin_static[0-9]+/(.*)$ {
proxy_pass http://localhost:8000/moin/$1;
}
}
location = /favicon.ico {
proxy_pass http://localhost:8000/moin/favicon.ico;
}
Thanks, Alexdem, good to know.
I’v altered to run Moinmoin wiki with fastcgi and Nginx for a long time.