# Location help

**URL:** <https://www.ruby-forum.com/t/location-help/122520>\
**Category:** NGINX\
**Created:** [December 8, 2007, 7:25pm UTC](https://www.ruby-forum.com/t/location-help/122520 "2007-12-08T19:25:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 8, 2007, 7:25pm UTC](https://www.ruby-forum.com/t/location-help/122520/1 "2007-12-08T19:25:13Z")

</div>

is there a way i can combine this into one location :

```
    location ~ ^/[^/]+\.ico$ {
        root /home/mark/work/pop/static;
    }
    location ~ ^/[^/]+\.xml$ {
        root /home/mark/work/pop/static;
    }
    location ~ ^/[^/]+\.xml.gz$ {
        root /home/mark/work/pop/static;
    }
    location ~ ^/[^/]+\.html$ {
        root /home/mark/work/pop/static;
    }
    location ~ ^/[^/]+\.txt$ {
        root /home/mark/work/pop/static;
    }
    location ~ ^/[^/]+\.txt.gz$ {
        root /home/mark/work/pop/static;
    }
```

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 8, 2007, 7:25pm UTC](https://www.ruby-forum.com/t/location-help/122520/2 "2007-12-08T19:25:48Z")

</div>

On Sat, Dec 08, 2007 at 10:16:12AM -0800, removed\_email\_address@domain.invalid wrote:

> ```
> root /home/mark/work/pop/static;
> }
> location ~ ^/[^/]+\.html$ {
> root /home/mark/work/pop/static;
> }
> location ~ ^/[^/]+\.txt$ {
> root /home/mark/work/pop/static;
> }
> location ~ ^/[^/]+\.txt.gz$ {
> root /home/mark/work/pop/static;
> }
> 
> ```

```
      location ~ ^/[^/]+\.(ico|xml|xml\.gz|html|txt|txt\.gz)$ {
          root /home/mark/work/pop/static;
      }
```

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 8, 2007, 7:33pm UTC](https://www.ruby-forum.com/t/location-help/122520/3 "2007-12-08T19:33:59Z")

</div>

On Dec 8, 2007 10:19 AM, Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > ```
> > root /home/mark/work/pop/static;
> > }
> > 
> > ```
> 
> ```
> location ~ ^/[^/]+\.(ico|xml|xml\.gz|html|txt|txt\.gz)$ {
> root /home/mark/work/pop/static;
> }
> 
> ```

thanks a lot! works great!!!  
these files will be served by nginx directly right? and not sent to  
backends? pl. correct me if i am wrong  
thanks

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 8, 2007, 7:40pm UTC](https://www.ruby-forum.com/t/location-help/122520/4 "2007-12-08T19:40:25Z")

</div>

On Sat, Dec 08, 2007 at 10:27:12AM -0800, removed\_email\_address@domain.invalid wrote:

> > > ```
> > > }
> > > 
> > > ```
> 
> backends? pl. correct me if i am wrong  
> Yes.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 8, 2007, 7:43pm UTC](https://www.ruby-forum.com/t/location-help/122520/5 "2007-12-08T19:43:58Z")

</div>

Am 08.12.2007 um 19:27 schrieb removed\_email\_address@domain.invalid:

> > ```
> > }
> > location ~ ^/[^/]+\.txt.gz$ {
> > root /home/mark/work/pop/static;
> > }
> > 
> > ```
> 
> ```
> location ~ ^/[^/]+\.(ico|xml|xml\.gz|html|txt|txt\.gz)$ {
> root /home/mark/work/pop/static;
> }
> 
> ```
> 
> thanks a lot! works great!!!  
> these files will be served by nginx directly right? and not sent to  
> backends? pl. correct me if i am wrong

Yes, they will be served from the filesystem.

HTH,

\_\_Janko
