Welcome! Log In Create A New Profile

Advanced

Re: nginx location - pass certain content type to apache backend

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

> 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 [b]/get[/b] location and pass them to apache instead?

There are two ways:

1) forbid testing regex after static "/get/..." matched:

location ^~ /get/ {

2) add second regex:

location ~ ^/get/.\.(jpg|png|mp3)$ {
proxy_pass http://domain-dev;

location ~* ^.+\.(jpg|png|mp3|ico|css|zip ...
...

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


See also:

http://nginx.org/en/docs/http/request_processing.html#simple_php_site_configuration


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx location - pass certain content type to apache backend

dannym May 15, 2010 05:01PM

Re: nginx location - pass certain content type to apache backend

Igor Sysoev May 16, 2010 04:56AM

Re: nginx location - pass certain content type to apache backend

dannym May 17, 2010 05:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 161
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready