# Nginx location - pass certain content type to apache backend

**URL:** <https://www.ruby-forum.com/t/nginx-location-pass-certain-content-type-to-apache-backend/188668>\
**Category:** NGINX\
**Created:** [May 15, 2010, 11:02pm UTC](https://www.ruby-forum.com/t/nginx-location-pass-certain-content-type-to-apache-backend/188668 "2010-05-15T23:02:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dannym](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7feea3/32.png) [@dannym](https://www.ruby-forum.com/u/dannym)\
**Post date:** [May 15, 2010, 11:02pm UTC](https://www.ruby-forum.com/t/nginx-location-pass-certain-content-type-to-apache-backend/188668/1 "2010-05-15T23:02:12Z")

</div>

Hi all,

I have following configuration

```
    location ~* 

```

^.+.(jpg|png|mp3|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js)$  
{  
root /data/www/domain.com/htdocs;  
access\_log off;  
expires max;  
add\_header Last-Modified: $date\_gmt;  
}

```
    location /get/ {
    proxy_pass http://domain-dev;
    }

```

How do I tell nginx to ignore serving jpg|png|mp3 for /get  
location and pass them to apache instead?

Thanks

Posted at Nginx Forum:

> **[nginx location - pass certain content type to apache backend](https://forum.nginx.org/read.php?2,87064,87064#msg-87064)**
>
> Hi all, I have following configuration location ~\* ^.+\\.(jpg|png|mp3|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js)$ { root /data/www/domain.com/htdocs; access\_log off; expires max;

---

<div class="post-metadata">

**Author:** ![dannym](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7feea3/32.png) [@dannym](https://www.ruby-forum.com/u/dannym)\
**Post date:** [May 16, 2010, 10:50am UTC](https://www.ruby-forum.com/t/nginx-location-pass-certain-content-type-to-apache-backend/188668/2 "2010-05-16T10:50:24Z")

</div>

On Sat, May 15, 2010 at 05:01:25PM -0400, dannym wrote:

> ```
> location /get/ {
> proxy_pass http://domain-dev;
> }
> 
> ```
> 
> How do I tell nginx to ignore serving jpg|png|mp3 for /get location and pass them to apache instead?

There are two ways:

1. forbid testing regex after static “/get/…” matched:

2. add second regex:

See also:

> **[How nginx processes a request](http://nginx.org/en/docs/http/request_processing.html#simple_php_site_configuration)**
>
> nginx first decides which server should process the request. Let’s start with a simple configuration where all three virtual servers listen on port \*:80:

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![dannym](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7feea3/32.png) [@dannym](https://www.ruby-forum.com/u/dannym)\
**Post date:** [May 17, 2010, 1:04pm UTC](https://www.ruby-forum.com/t/nginx-location-pass-certain-content-type-to-apache-backend/188668/3 "2010-05-17T13:04:46Z")

</div>

Exact match is working. Thanks, Igor.

Posted at Nginx Forum:

> **[Re: nginx location - pass certain content type to apache backend](https://forum.nginx.org/read.php?2,87064,87383#msg-87383)**
>
> Hi all, I have following configuration location ~\* ^.+\\.(jpg|png|mp3|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js)$ { root /data/www/domain.com/htdocs; access\_log off; expires max;
