# Fastcgi and $document\_uri

**URL:** <https://www.ruby-forum.com/t/fastcgi-and-document-uri/223390>\
**Category:** NGINX\
**Created:** [October 2, 2012, 3:30pm UTC](https://www.ruby-forum.com/t/fastcgi-and-document-uri/223390 "2012-10-02T15:30:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [October 2, 2012, 3:30pm UTC](https://www.ruby-forum.com/t/fastcgi-and-document-uri/223390/1 "2012-10-02T15:30:51Z")

</div>

Hi all,

I’m trying to setup nginx as bellow:  
location ~ ^/git(.\*)$ {  
include /etc/nginx/fastcgi.conf;  
fastcgi\_param PATH\_INFO $1;  
fastcgi\_pass 127.0.0.1:8010;

```
  }

```

For information, /etc/nginx/fastcgi.conf:  
fastcgi\_param SCRIPT\_FILENAME  
$document\_root$fastcgi\_script\_name;  
fastcgi\_param QUERY\_STRING  
$query\_string;  
fastcgi\_param REQUEST\_METHOD  
$request\_method;  
fastcgi\_param CONTENT\_TYPE  
$content\_type;  
fastcgi\_param CONTENT\_LENGTH  
$content\_length;

fastcgi\_param SCRIPT\_NAME  
$fastcgi\_script\_name;  
fastcgi\_param REQUEST\_URI  
$request\_uri;  
fastcgi\_param DOCUMENT\_URI  
$document\_uri;  
fastcgi\_param DOCUMENT\_ROOT  
$document\_root;  
fastcgi\_param SERVER\_PROTOCOL  
$server\_protocol;

fastcgi\_param GATEWAY\_INTERFACE  
CGI/1.1;  
fastcgi\_param SERVER\_SOFTWARE  
nginx/$nginx\_version;

fastcgi\_param REMOTE\_ADDR  
$remote\_addr;  
fastcgi\_param REMOTE\_PORT  
$remote\_port;  
fastcgi\_param SERVER\_ADDR  
$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;  
fastcgi\_pass 127.0.0.1:8010;  
}

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,  
Thanks.
