[uWSGI] nginx+uwsgi problem: Can't set empy SCRIPT_NAME param

Andrey Petrov shazow at gmail.com
Sat Jul 3 01:30:51 CEST 2010

Hi, I'm deploying my Pylons application on Nginx using uwsgi, and I'm trying
to set an empty SCRIPT_NAME because otherwise my Pylons application prepends
an extra / in front of all non-absolute URLs.

Here is the relevant part of the configuration:

server {

        location / {
                root    /var/lib/wsgi/;
                uwsgi_pass   unix:///tmp/uwsgi.sock;
                uwsgi_param UWSGI_SCRIPT wsgi;
                uwsgi_param SCRIPT_NAME /;
                include        uwsgi_params;

When I try to remove the SCRIPT_NAME param or set it to SCRIPT_NAME "";,
Nginx stops serving the app with this error: "wsgi application not found"

Right now, with the extra / it works fine but I have to perform a nasty hack
in my wsgi Oython application container:

from paste.deploy import loadapp

actual_application = loadapp('config:/var/lib/wsgi/src/path/to/my.ini')

def wrapper_application(environ, start_response):
        if environ["SCRIPT_NAME"] == "/":
                environ["SCRIPT_NAME"] = ""
        return actual_application(environ, start_response)

application = wrapper_application

The uwsgi command running within supervisord:

/usr/bin/uwsgi --pidfile /var/run/uwsgi.pid -s /tmp/uwsgi.sock -C -M 4 -A 4
-m -H /var/lib/wsgi/ --pythonpath /var/lib/wsgi --uid 33 --gid 33 -L



Is there any way to set an empty SCRIPT_NAME in the uwsgi nginx
configuration? Am I missing something?

Thank you in advance!

- Andrey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.unbit.it/pipermail/uwsgi/attachments/20100702/cb3ac83e/attachment.htm 

More information about the uWSGI mailing list