# Nginx rewrite help

**URL:** <https://www.ruby-forum.com/t/nginx-rewrite-help/170499>\
**Category:** NGINX\
**Created:** [June 18, 2009, 6:31am UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499 "2009-06-18T06:31:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 6:31am UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/1 "2009-06-18T06:31:04Z")

</div>

hei guys  
i want all urls to be re-written as follows:

xx /host/xx

xx is the url full path, it should be written as /domain/xx where host  
is  
the hostname.

for example [www.ABCD.COM](http://www.ABCD.COM) [http://www.abcd.com/](http://www.abcd.com/)

/test?1 —\> /ABCD.COM/test?1 [http://abcd.com/test?1](http://abcd.com/test?1)  
is it possible to do this with nginx?  
thank you!

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 6:49am UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/2 "2009-06-18T06:49:46Z")

</div>

On Thu, Jun 18, 2009 at 11:22 AM, Kevin  
Castiglione[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> /test?1 —\> /ABCD.COM/test?1  
> is it possible to do this with nginx?  
> thank you!

rewrite ^(.\*)$ /$host$1;

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 6:53am UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/3 "2009-06-18T06:53:17Z")

</div>

On Thu, Jun 18, 2009 at 11:42 AM, Edho P Arief[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > for example [www.ABCD.COM](http://www.ABCD.COM)
> > 
> > /test?1 —\> /ABCD.COM/test?1  
> > is it possible to do this with nginx?  
> > thank you!
> 
> rewrite ^(.\*)$ /$host$1;

add redirect/permanent for external redirect.

rewrite ^.\* /$host$uri;

can also be used (less captures hence faster?)

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 7:19am UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/4 "2009-06-18T07:19:00Z")

</div>

On Thu, Jun 18, 2009 at 11:49 AM, Edho P Arief[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > > > the hostname.  
> > > > add redirect/permanent for external redirect.
> > 
> > rewrite ^.\* /$host$uri;
> > 
> > can also be used (less captures hence faster?)

here’s the complete block

location ~ ^(?!/www.abcd.com) {  
rewrite ^.\*$ /$host$uri;  
}

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 9:55am UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/5 "2009-06-18T09:55:06Z")

</div>

On Wed, Jun 17, 2009 at 09:22:46PM -0700, Kevin Castiglione wrote:

> /test?1 —\> /ABCD.COM/test?1 [http://abcd.com/test?1](http://abcd.com/test?1)  
> is it possible to do this with nginx?  
> thank you!

Should it be redirect or what ?

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 6:55am UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/6 "2009-06-18T06:55:37Z")

</div>

On Thu, Jun 18, 2009 at 11:46 AM, Edho P Arief[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > >
> 
> rewrite ^.\* /$host$uri;
> 
> can also be used (less captures hence faster?)

whoops don’t forget to add last;

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 3:53pm UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/7 "2009-06-18T15:53:33Z")

</div>

2009/6/18 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> > for example [www.ABCD.COM](http://www.ABCD.COM) [http://www.abcd.com/](http://www.abcd.com/)
> > 
> > /test?1 —\> /ABCD.COM/test?1 [http://abcd.com/test?1](http://abcd.com/test?1)  
> > is it possible to do this with nginx?  
> > thank you!
> 
> Should it be redirect or what ?

i dont want it to be a permanent redirect. i just want the url to be  
rewritten for application processing. i want different domains to be  
handled  
by same web app an dmy webframe work supports only url-level application  
mapping. that is why i need this rewrite.  
thank you

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 3:45pm UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/8 "2009-06-18T15:45:55Z")

</div>

On Wed, Jun 17, 2009 at 10:09 PM, Edho P Arief [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> location ~ ^(?!/www.abcd.com) {  
> rewrite ^.\*$ /$host$uri;  
> }

hi edho,  
thanks a lot for this. does $host represent [www.abcd.com](http://www.abcd.com) or [abcd.com](http://abcd.com)?  
thanks again!

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 4:29pm UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/9 "2009-06-18T16:29:24Z")

</div>

2009/6/18 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> > > > 
> > > 
> > > Should it be redirect or what ?
> 
> server {
> 
> location / {  
> proxy\_pass [http://backend/$host$request\_uri](http://backend/$host$request_uri);  
> }
> 
> }

im using fastcgi backend.

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 4:01pm UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/10 "2009-06-18T16:01:11Z")

</div>

On Thu, Jun 18, 2009 at 06:38:54AM -0700, Kevin Castiglione wrote:

> > > the hostname.  
> > > i dont want it to be a permanent redirect. i just want the url to be  
> > > rewritten for application processing. i want different domains to be handled  
> > > by same web app an dmy webframe work supports only url-level application  
> > > mapping. that is why i need this rewrite.  
> > > thank you

If you use proxing, then

server {

location / {  
proxy\_pass [http://backend/$host$request\_uri](http://backend/$host$request_uri);  
}

}

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 4:35pm UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/11 "2009-06-18T16:35:17Z")

</div>

On Thu, Jun 18, 2009 at 07:21:33AM -0700, Kevin Castiglione wrote:

> > > > > thank you!
> 
> im using fastcgi backend.  
> Then

location / {  
…  
fastcgi\_param SCRIPT\_FILENAME  
/path/to/scripts/$host$fastcgi\_script\_name;  
…  
}

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 5:03pm UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/12 "2009-06-18T17:03:38Z")

</div>

On Thu, Jun 18, 2009 at 07:44:55AM -0700, Kevin Castiglione wrote:

> > > > > > On Wed, Jun 17, 2009 at 09:22:46PM -0700, Kevin Castiglione wrote:
> > > > > > 
> > > > > > > for example [www.ABCD.COM](http://www.ABCD.COM) [http://www.abcd.com/](http://www.abcd.com/)  
> > > > > > > handled  
> > > > > > > proxy\_pass [http://backend/$host$request\_uri](http://backend/$host$request_uri);  
> > > > > > > fastcgi\_param SCRIPT\_FILENAME  
> > > > > > > /path/to/scripts/$host$fastcgi\_script\_name;  
> > > > > > > …  
> > > > > > > }
> 
> igor:  
> does this mean the backend fastcgi processes have to be in the same machine?  
> i have my backends running on different machine like this

No, this path  
/path/to/scripts/$host$fastcgi\_script\_name;  
may be on any host.

In your case you need probably this:

```
  fastcgi_param SCRIPT_FILENAME /$host$fastcgi_script_name;

```

> ```
> }
> fastcgi_param SERVER_ADDR $server_addr;
> fastcgi_param SERVER_PORT $server_port;
> fastcgi_param SERVER_NAME $server_name;
> }
> 
> }
> 
> ```

Also, this

```
   if ($http_x_forwarded_for ~ "(?:^|,)\s*(\d+\.\d+\.\d+\.\d+)\s*$") 

```

{  
set $addr $1;  
}

```
   fastcgi_param REMOTE_ADDR $addr;

```

means that anyone may forge his address.

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 4:57pm UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/13 "2009-06-18T16:57:44Z")

</div>

2009/6/18 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> > > > > > hei guys  
> > > > > > /test?1 —\> /ABCD.COM/test?1 [http://abcd.com/test?1](http://abcd.com/test?1)  
> > > > > > application
> 
> ```
> ...
> 
> ```
> 
> }

igor:  
does this mean the backend fastcgi processes have to be in the same  
machine?  
i have my backends running on different machine like this

```
upstream backend_flock{
    server app1.YYY.com:8491 fail_timeout=1s;
    server app2.YYY.com:8491 fail_timeout=1s;
}
server {
    server_name .XXX.com;
    listen 80;
    access_log logs/access.log;

    client_max_body_size 10m;
    location / {
        root /home/app/flock;

        fastcgi_pass backend_flock;
        set $addr $remote_addr;

        if ($http_x_forwarded_for ~

```

“(?:^|,)\s\*(\d+.\d+.\d+.\d+)\s\*$”) {  
set $addr $1;  
}

```
        fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_script_name;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param REMOTE_ADDR $addr;
        fastcgi_param REMOTE_PORT $remote_port;
        fastcgi_param SERVER_PROTOCOL $server_protocol;
        fastcgi_param SERVER_ADDR $server_addr;
        fastcgi_param SERVER_PORT $server_port;
        fastcgi_param SERVER_NAME $server_name;
    }

}

```

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 5:20pm UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/14 "2009-06-18T17:20:05Z")

</div>

2009/6/18 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> > > > > > 2009/6/18 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > > > > > where
> > > > > > 
> > > > > > >
> > > > 
> > > > im using fastcgi backend.  
> > > > igor:  
> > > > fastcgi\_param SCRIPT\_FILENAME /$host$fastcgi\_script\_name;  
> > > > so with this i dont need to write any rewrite rule?

also instead of $host, if i want to use domain or subdomain can you tell  
how  
i can extract: [[aa.bb.com](http://aa.bb.com)]  
 → domain - [bb.com](http://bb.com)  
 → subdomain - aa

> Also, this
> 
> ```
> if ($http_x_forwarded_for ~ "(?:^|,)\s*(\d+\.\d+\.\d+\.\d+)\s*$") {
> set $addr $1;
> }
> 
> fastcgi_param REMOTE_ADDR $addr;
> 
> ```
> 
> means that anyone may forge his address.

without this my web app gets client ip address as the ip address of the  
machine running nginx and not the actual client.

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 5:31pm UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/15 "2009-06-18T17:31:49Z")

</div>

On Thu, Jun 18, 2009 at 08:10:27AM -0700, Kevin Castiglione wrote:

> > > > > > On Thu, Jun 18, 2009 at 06:38:54AM -0700, Kevin Castiglione wrote:
> > > > > > 
> > > > > > > > >
> > > > > > > 
> > > > > > > mapping. that is why i need this rewrite.  
> > > > > > > }  
> > > > > > > }  
> > > > > > > In your case you need probably this:
> > 
> > ```
> > fastcgi_param SCRIPT_FILENAME /$host$fastcgi_script_name;
> > 
> > ```
> 
> so with this i dont need to write any rewrite rule?

Yes.

> also instead of $host, if i want to use domain or subdomain can you tell how  
> i can extract: [[aa.bb.com](http://aa.bb.com)]  
> → domain - [bb.com](http://bb.com)  
> → subdomain - aa

```
server {
     server_name ~^([^.])\.(.+)$)$;

     set $subdomain $1;
     set $domain $2;

     location / {
         fastcgi_param SCRIPT_FILENAME /$domain$fastcgi_script_name;

```

> without this my web app gets client ip address as the ip address of the  
> machine running nginx and not the actual client.

```
 fastcgi_param REMOTE_ADDR $remote_addr;

```

sets address of nginx’s client.

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 18, 2009, 5:31pm UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/16 "2009-06-18T17:31:13Z")

</div>

On Thu, Jun 18, 2009 at 10:10 PM, Kevin  
Castiglione[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > means that anyone may forge his address.
> 
> without this my web app gets client ip address as the ip address of the  
> machine running nginx and not the actual client.

why not

fastcgi\_param REMOTE\_ADDR $remote\_addr;

?  
or is this for nginx on another pc used as proxy backend?

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 19, 2009, 2:37am UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/17 "2009-06-19T02:37:26Z")

</div>

2009/6/18 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> > > > > > 2009/6/18 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> > > > > > 
> > > > > > > > > > i want all urls to be re-written as follows:
> > > > > > > > 
> > > > > > > > rewritten for application processing. i want different  
> > > > > > > > server {
> > > > 
> > > > i have my backends running on different machine like this
> 
> Yes.

igor,  
i changed this and tried. it does not have any affect on the url  
mapping. my  
fastcgi backend still gets the same url as before.  
this is what i see, with the change you had given.  
[xx.com domain name is for sale. Inquire now.](http://xx.com/yy) —\> [xx.com domain name is for sale. Inquire now.](http://xx.com/yy)

while this is what i want on the webapp/fastcgi backend  
[xx.com domain name is for sale. Inquire now.](http://xx.com/yy) → [xx.com domain name is for sale. Inquire now.](http://xx.com/xx.com/yy)  
im pasting my full config here:

#user nobody;  
worker\_processes 1;

error\_log /home/app/error\_all.log;  
pid /home/app/nginx.pid;

events {  
worker\_connections 1024;  
}

http {  
include mime.types;  
default\_type application/octet-stream;  
client\_header\_buffer\_size 8k;  
large\_client\_header\_buffers 4 8k;  
fastcgi\_buffers 32 4k;  
fastcgi\_buffer\_size 4k;  
sendfile on;

```
server_names_hash_bucket_size 64;
keepalive_timeout 5;

gzip on;
gzip_comp_level 1;
gzip_proxied private;
gzip_buffers 8 4k;

upstream backend_flock{
    server app1.XXX.com:8492 fail_timeout=1s;
}
server {
    listen 8080;
    access_log /home/app/access_flock.log;

    client_max_body_size 10m;

    location /static {
        root /home/app/work/flock;
    }
    location / {
        root /home/app/work/flock;

        fastcgi_pass backend_flock;

        fastcgi_param SCRIPT_FILENAME /$host$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_script_name;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param REMOTE_ADDR $remote_addr;
        fastcgi_param REMOTE_PORT $remote_port;
        fastcgi_param SERVER_PROTOCOL $server_protocol;
        fastcgi_param SERVER_ADDR $server_addr;
        fastcgi_param SERVER_PORT $server_port;
        fastcgi_param SERVER_NAME $server_name;

    }

}

```

}

> > > means that anyone may forge his address.
> > 
> > without this my web app gets client ip address as the ip address of the  
> > machine running nginx and not the actual client.
> 
> ```
> fastcgi_param REMOTE_ADDR $remote_addr;
> 
> ```
> 
> sets address of nginx’s client.

this works great!!  
thanks a lot!

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 19, 2009, 6:06am UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/18 "2009-06-19T06:06:11Z")

</div>

On Fri, Jun 19, 2009 at 7:26 AM, Kevin  
Castiglione[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Â Â Â Â Â Â Â Â Â Â Â fastcgi\_pass backend\_flock;
> 
> Â Â Â Â Â Â Â Â Â Â Â - fastcgi\_param SCRIPT\_FILENAME /$host$fastcgi\_script\_name;

- fastcgi\_param SCRIPT\_FILENAME /$host/$host$fastcgi\_script\_name;

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 19, 2009, 2:37am UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/19 "2009-06-19T02:37:27Z")

</div>

On Thu, Jun 18, 2009 at 8:23 AM, Edho P Arief [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > >
> 
> fastcgi\_param REMOTE\_ADDR $remote\_addr;

this works great!!!  
thanks

---

<div class="post-metadata">

**Author:** ![Kevin\_Castiglione](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Kevin\_Castiglione](https://www.ruby-forum.com/u/Kevin_Castiglione)\
**Post date:** [June 19, 2009, 7:28am UTC](https://www.ruby-forum.com/t/nginx-rewrite-help/170499/20 "2009-06-19T07:28:40Z")

</div>

On Thu, Jun 18, 2009 at 8:55 PM, Edho P Arief [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> On Fri, Jun 19, 2009 at 7:26 AM, Kevin  
> Castiglione[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > ```
> > fastcgi_pass backend_flock;
> > 
> > - fastcgi_param SCRIPT_FILENAME /$host$fastcgi_script_name;
> > 
> > ```
> 
> - fastcgi\_param SCRIPT\_FILENAME /$host/$host$fastcgi\_script\_name;

Edho  
This also produces the same result. the mapping does not work as  
expected.  
thank you!

[Next page](https://www.ruby-forum.com/t/nginx-rewrite-help/170499.md?page=2)
