Description
If you run a farmwiki directly with uWSGI (http-server mode) and only have a "dump" front-end-proxy before your FarmWiki, MoinMoin can't split the correct subwiki path and the wikipage path itself (e.g. /subwiki/page) and binds everthing to the root e.g. subwiki = "" / wikipage = "/subwiki/page"
I belive it's because MoinMoin heavy depends on the correct PATH_INFO and SCRIPT_NAME (both variables from wsgi stuff). And if I run the test.wsgi script I see that SCRIPT_NAME is empty and PATH_INFO containts the full path from the sever. This is becasue the server (uwsgi) doesn't know anything about my farmwiki configuration.
Under Apache with mod_wsgi you can use WSGIScriptAlias /subwiki /home/<username>/moinmoin/etc/moin.wsgi and then PATH_INFO containts only the wikipage (and subpages) adn the SCRIPT_NAME is ="/subwiki".
With uWSGI there is an example (http://projects.unbit.it/uwsgi/wiki/Example) that you can mount a wiki to a subpath, but it depends on nginx to set the correct SCRIPT_NAME.. and I would like to run it wihtout nginx
Steps to reproduce
- running a farmwiki behind uwsgi (http server) without apache or nginx
Example
Working "apache with modwsgi"
test.wsgi: http://test2.heavy.ch/subwiki/page (see the PATH_INFO and SCRIPT_NAME correctly splitted)
Live Site: http://www.heavy.ch/rock
Not Working "uwsgi"
test.wsgi: test-wsgi-output.html
Test Site: http://www.test.heavy.ch/rock (is not always working 'coz I'm trying different configuration options out)
uwsgi.ini (configuration file):
http = 127.0.0.1:19153 chdir = /home/lotekuwsgi/var/moinmoin/etc pythonpath = /home/lotekuwsgi/lib/python2.7/ wsgi-file = /home/lotekuwsgi/var/moinmoin/etc/moin.wsgi pidfile = /home/lotekuwsgi/var/run/uwsgi-moinmoin.pid master = true processes = 3 threads = 2 harakiri = 30 vacuum = true max-requests = 5000 reload-on-rss = 200 evil-reload-on-rss = 250 daemonize = /home/lotekuwsgi/var/log/uwsgi-moinmoin.log memory-report = true
Component selection
- uwsgi configuration
- moinmoin farmwiki stuff
Details
MoinMoin Version |
1.9.x (latest from repository) |
OS and Version |
Linux |
Python Version |
2.7.x |
Server Setup |
shared hosting |
Server Details |
Frontend Proxy (nginx) to locahlost:xxx |
Language you are using the wiki in (set in the browser/UserPreferences) |
en |
Workaround
- none (running with a frontend server like apache would I guess work)
I'm looking in the uwsgi stuff a similary feature like WSGIScriptAlias. As far as I dig into the UWSGI Docs I could found some hints about route to set manualy the SCRIPT_NAME and PATH_INFO:
#route-run = addvar:SCRIPT_NAME=/subwiki #route-run = addvar:PATH_INFO=/page
... but that's not helping 'coz both variables should be dynamic and I think maybe MoinMoin should set the correct variables if a farmwiki is active, but well I'm not sure.
At the moment my next hope is to somehow set the needed variables directly in the FarmConfig of the subwiki. But I'm not sure if ths is already to late.
Solution
I found a way to manipulate via regex the SCRIPT_NAME and PATH_INFO in the uwsgi. with this regex I split the first part (till /) as the SCRIPOT_NAME and the Rest goes into PATH_INFO. As far as I testet, it works.
route = ^/([^/]*) addvar:SCRIPT_NAME=/$1 route = ^/(?:[^/]*)/(.*) addvar:PATH_INFO=/$1
Discussion
I also added a question to the community site of my shared hosting community.webfaction.com
Plan
- Priority:
- Assigned to:
- Status: