fastcgi and $document_uri

Gautier DI FOLCO gautier.difolco at
Tue Oct 2 13:29:54 UTC 2012

Hi all,

I'm trying to setup nginx as bellow:
      location ~ ^/git(.*)$ {
         include /etc/nginx/fastcgi.conf;
         fastcgi_param  PATH_INFO        $1;


For information, /etc/nginx/fastcgi.conf:
fastcgi_param  SCRIPT_FILENAME
fastcgi_param  QUERY_STRING
fastcgi_param  REQUEST_METHOD
fastcgi_param  CONTENT_TYPE
fastcgi_param  CONTENT_LENGTH

fastcgi_param  SCRIPT_NAME
fastcgi_param  REQUEST_URI
fastcgi_param  DOCUMENT_URI
fastcgi_param  DOCUMENT_ROOT
fastcgi_param  SERVER_PROTOCOL

fastcgi_param  GATEWAY_INTERFACE
fastcgi_param  SERVER_SOFTWARE

fastcgi_param  REMOTE_ADDR
fastcgi_param  REMOTE_PORT
fastcgi_param  SERVER_ADDR
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

It works well, for example, for /git/repo1.git, the PATH_INFO if /repo1.git.
I think using regex is slow, I tryied this :
      location /git {
         include /etc/nginx/fastcgi.conf;
         fastcgi_param  PATH_INFO        $document_uri;

But /git/repo1.git gives me /git/repo1.git instead of I expected /repo1.git.
Why? is their a mean to do not use regex or do it faster?

For your help,
In advance,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list