Welcome! Log In Create A New Profile

Advanced

Re: Use nginx as proxy with cache for satic files

Anonymous User
September 05, 2009 06:24AM
> Hi,
>
> Settings in your / location will not be inherited by those in other
> locations. The proxy_pass directive can only go in location or
> location-if (i.e. an if (...) {...} inside a location), and can't go at
> the server level, so you'd have to define the proxy_pass setting in each
> location it's used.
>
> http://wiki.nginx.org/NginxHttpProxyModule#proxy_pass

Okay, that's what I thought.

> > In other words: I want all requests going through the proxy, but keep
> > a cache of ceartain folders on the nginx server. What is the best way
> > to do so?
> >
> Probably by putting common settings (which might just be proxy_pass
> http://backend.server.org;) in another file and including the file -
> then you'd only have to change the address / port once.
>
> If you have multiple locations you want to cache, you could have three
> files:
>
> proxy.conf : (with just the proxy info)
>
> proxy_pass http://backend.server.org;
>
> proxy_cache.conf : (with the proxy and the cache info)
>
> include proxy.conf;
> proxy_cache cache;
> proxy_cache_valid 200 10m;
>
> nginx.conf : (with the rest)
>
> ...
> location / {
> include proxy.conf;
> }
>
> location /images/ {
> include proxy_cache.conf;
> }
>
> location /other-cache/ {
> include proxy_cache.conf;
> }
> ...
>
> Hope that helps,
>
> Marcus.

Thank you very much, Marcus, I didn't think about "include" at all.
Although this way still seems kind of intricate to me, it is probably
the easiest way to get what I want. I will try it like that and hope it
works.

Regards,
Alfred
Subject Author Posted

Use nginx as proxy with cache for satic files

Anonymous User September 04, 2009 04:40PM

Re: Use nginx as proxy with cache for satic files

Marcus Clyne September 04, 2009 06:08PM

Re: Use nginx as proxy with cache for satic files

Anonymous User September 05, 2009 06:24AM

Re: Use nginx as proxy with cache for satic files

Marcus Clyne September 05, 2009 08:30AM

Re: Use nginx as proxy with cache for satic files

Igor Sysoev September 05, 2009 08:32AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 140
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