WebFaction
Community site: login faq

Hi there

I installed a standalone uwsgi server behind the nginx fronend server from webfaction (customport, etcetera). I would like to run with the uwsgi a wsgi application (MoinMoin).

The only problem now is, that the "path" are not correctly used by the wsgi application (MoinMoin) itself or not fully submitted from uwsgi (PATH_INFO, SCRIPT_NAME).

With MoinMoin you could have a farmwiki configuration, where you could run multiple wikis. With Apache & modwsgi it worked very well 'coz you could define some kind of aliases for the subwikis in the apache config itself, e.g:

WSGIScriptAlias /wiki /home/<username>/moinmoin/etc/moin.wsgi
WSGIScriptAlias /rock /home/<username>/moinmoin/etc/moin.wsgi

But now with only uwsgi, all subwikis thinks that they are bounded to the root /. I belive its because of the missing SCRIPT_NAME and "wrong" PATH_INFO.

Some Additional Information

1. Routing

Using route (maybe together with "setapp") could help, http://uwsgi-docs.readthedocs.org/en/latest/InternalRouting.html but I don't know how to split and modifie the SCRIPT_NAME and PATH_INFO

route-run = addvar:SCRIPT_NAME=/subiwiki
route-run = addvar:PATH_INFO=/page

this logical. works but only for a single page e.g "/page" and no other page e.g. "/page2"

2. Comparing

I compared my current working apache/mod_wsgi installation. here the difference:

Apache (current running system)

http://www.heavy.ch/subwiki/page

Configuration in my apache for mod_wsgi:

WSGIScriptAlias /subwiki /home/lotek/moinmoin/etc/moin.wsgi

WSGI variables generating:

  • SCRIPT_NAME = '/subiwki'
  • PATH_INFO = '/page'

UWSGI (new, not working system)

http://www.test.heavy.ch/subwiki/page

WSGI variables:

  • SCRIPT_NAME = ''
  • PATH_INFO = '/subwiki/page''

The key seems that the apache/mod_wsgi setting the variables with WSGIScriptAlias

bye Marcel


uwsgi configuration

[uwsgi]
http = 127.0.0.1:19153
chdir = /home/<username>/var/moinmoin/etc
pythonpath = /home/<username>/lib/python2.7/
wsgi-file = /home/<username>/var/moinmoin/etc/moin.wsgi
pidfile = /home/<username>/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/<username>/var/log/uwsgi-moinmoin.log
memory-report = true

moin.wsgi file

from MoinMoin.web.serving import make_application
from MoinMoin.web.serving import ProxyTrust
# Creating the WSGI application
# use shared=True to have moin serve the builtin static docs
# use shared=False to not have moin serve static docs
# use shared='/my/path/to/htdocs' to serve static docs from that path
application = make_application(shared=False, trusted_proxies=['127.0.0.1',])

farmwiki config (MoinMoin)

# Wikis in your farm
wikis = [
    ("HeavyWiki",       r"^https?://www\.test\.heavy\.ch/wiki.*$"),
    ("RockHeavy",       r"^https?://www\.test\.heavy\.ch/(rock|glam).*$"),
    ("IntranetWiki",    r"^https?://www\.test\.heavy\.ch/intranet.*$"),
    ("GalaxyWiki",      r"^https?://www\.test\.heavy\.ch/galaxy.*$"),
    ]

asked 18 Oct '13, 12:56

marcel's gravatar image

marcel
651415
accept rate: 0%

edited 20 Oct '13, 04:46


If you have not already posted the question to the moinmoin community I would suggest doing so, as they should know how to fix this issue and if not it should be addressed by their community as a bug. According to uwsgi's docs the correct method is what you are doing, which is to define the config within the nginx.conf file as a 'location' directive.

permanent link

answered 18 Oct '13, 17:19

johns's gravatar image

johns ♦♦
4.8k29
accept rate: 22%

yes, but the different is that I do not want to use nginx, so I can't use location.

that's why I think maybe that my uwsgi config is not submitting the correct SCRIPT_NAME to my moinmoin app.

In fact I lookin for a https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIScriptAliasMatch similary feature in uwsgi...

(19 Oct '13, 02:37) marcel marcel's gravatar image

you're right. even with nginx before it can't handle mulitplewikis (farmconfig). I'll check it out with the moinmoin devs. thanks

(19 Oct '13, 12:37) marcel marcel's gravatar image

I found a way to manipulate directly in the uwsgi the SCRIPT_NAME and PATH_INFO. Here is my used uwsgi ini-file for running moinmoin as farmwiki without nginx (just a simple uwsgi installation with "pip install uwsgi")

[uwsgi]

# Server
http = 127.0.0.1:<portnumber>

# Path
chdir = /home/<username>/var/moinmoin/etc
pythonpath = /home/<username>/lib/python2.7/

# Static
check-static =  /home/<username>/var/www/

# General Routing
route = ^/$ rewrite:/wiki/

# WSGI Variables
route = ^/([^/]*) addvar:SCRIPT_NAME=/$1
route = ^/(?:[^/]*)/(.*) addvar:PATH_INFO=/$1

# WSGI
wsgi-file = /home/<username>/var/moinmoin/etc/moin.wsgi
pidfile = /home/<username>/var/run/uwsgi-moinmoin.pid

# Process
master = true
processes = 3
threads = 5
offload-threads = 5

# Safety
harakiri = 30
vacuum = true
max-requests = 5000
reload-on-rss = 200
evil-reload-on-rss = 250

# Logfile
daemonize = /home/<username>/var/log/uwsgi-moinmoin.log
memory-report = true
permanent link

answered 20 Oct '13, 08:06

marcel's gravatar image

marcel
651415
accept rate: 0%

edited 21 Oct '13, 04:01

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×61
×28
×17
×6

question asked: 18 Oct '13, 12:56

question was seen: 5,055 times

last updated: 21 Oct '13, 04:01

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM