[dev] SCRIPT_NAME and PATH_INFO

Manlio Perillo manlio_perillo at libero.it
Tue Sep 11 19:52:34 MSD 2007


Hi all.

I want to implement these two CGI environment variables for mod_wsgi, as 
nginx variables.

The WSGI spec says:

SCRIPT_NAME
     The initial portion of the request URL's "path" that corresponds to
     the application object, so that the application knows its virtual
     "location". This may be an empty string, if the application
     corresponds to the "root" of the server.

PATH_INFO
     The remainder of the request URL's "path", designating the virtual
     "location" of the request's target within the application. This may
     be an empty string, if the request URL targets the application root
     and does not have a trailing slash.


This means, as an example, that with this configuration:
server {
     listen       8080;
     server_name  localhost;

     location / {
     	root   html;
         index  index.html index.htm;
     }
		
     location /wsgi {
	wsgi_alias /usr/local/nginx/nginx.py;
     }
}

and this request URI: http://localhost/wsgi/a/b

we have (not sure about trailing/leading slash):
SCRIPT_NAME = /wsgi
PATH_INFO = /a/b



How can this be implemented with nginx?
Is the "location path" available from the request object?
Or should I just define the script_name in the loc_conf?



Thanks  Manlio Perillo





More information about the nginx mailing list