|
12
|
Hi Guys,
I was hoping someone could point out a document where it can teach me
how to setup nginx + caching. I know that traditionally nginx did not
have a native caching and it required you to run ncache or cachemem in
order to perform caching of static content... but does nginx now allow
basic static file caching without the use of any other 3rd app?
Im trying to understand if nginx now has a native caching which would
allow caching of static content. I dont want to get fancy in anyway, I
simply want to allocate say 200mb of storage space to allow caching of
static content. the 200mb should be updated with the most
active/recently seen file request.
reason? im trying to allow nginx to serve the static files from disk
(if it has seen it previously) and not have to go back to the origin
server every single time.
Thanks
Payam
|
|
On Mon, Apr 06, 2009 at 10:14:36PM -0700, Payam Chychi wrote:
> Hi Guys,
>
> I was hoping someone could point out a document where it can teach me
> how to setup nginx + caching. I know that traditionally nginx did not
> have a native caching and it required you to run ncache or cachemem in
> order to perform caching of static content... but does nginx now allow
> basic static file caching without the use of any other 3rd app?
>
> Im trying to understand if nginx now has a native caching which would
> allow caching of static content. I dont want to get fancy in anyway, I
> simply want to allocate say 200mb of storage space to allow caching of
> static content. the 200mb should be updated with the most
> active/recently seen file request.
>
> reason? im trying to allow nginx to serve the static files from disk
> (if it has seen it previously) and not have to go back to the origin
> server every single time.
Get the lastest nginx (0.7.50) and use
proxy_cache_path /path/to/cache levels=1:2
keys_zone=one:10m
inactive=7d max_size=200m;
proxy_temp_path /path/to/temp; # must be on the same filesystem
# as cache
server {
location / {
proxy_pass http://backend; proxy_cache one;
proxy_cache_key backend$request_uri;
proxy_cache_valid 200 1h;
proxy_cache_use_stale error timeout invalid_header;
}
--
Igor Sysoev
http://sysoev.ru/en/
|
|
2009/4/6 Igor Sysoev < [hidden email]>:
> On Mon, Apr 06, 2009 at 10:14:36PM -0700, Payam Chychi wrote:
>
>> Hi Guys,
>>
>> I was hoping someone could point out a document where it can teach me
>> how to setup nginx + caching. I know that traditionally nginx did not
>> have a native caching and it required you to run ncache or cachemem in
>> order to perform caching of static content... but does nginx now allow
>> basic static file caching without the use of any other 3rd app?
>>
>> Im trying to understand if nginx now has a native caching which would
>> allow caching of static content. I dont want to get fancy in anyway, I
>> simply want to allocate say 200mb of storage space to allow caching of
>> static content. the 200mb should be updated with the most
>> active/recently seen file request.
>>
>> reason? im trying to allow nginx to serve the static files from disk
>> (if it has seen it previously) and not have to go back to the origin
>> server every single time.
>
> Get the lastest nginx (0.7.50) and use
>
> proxy_cache_path /path/to/cache levels=1:2
> keys_zone=one:10m
> inactive=7d max_size=200m;
>
> proxy_temp_path /path/to/temp; # must be on the same filesystem
> # as cache
>
> server {
>
> location / {
> proxy_pass http://backend;>
> proxy_cache one;
> proxy_cache_key backend$request_uri;
> proxy_cache_valid 200 1h;
> proxy_cache_use_stale error timeout invalid_header;
> }
>
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/>
>
proxy_cache_path /path/to/cache levels=1:2
keys_zone=one:10m
inactive=7d max_size=200m;
proxy_temp_path /path/to/temp; # must be on the same filesystem
# as cache
server {
location / {
proxy_pass http://backend; proxy_cache one;
proxy_cache_key backend$request_uri;
proxy_cache_valid 200 1h;
proxy_cache_use_stale error timeout invalid_header;
}
few questions:
1- what does the keys_zone used for
2- what does the "200 1h" in proxy_cache_valid mean
3- how is the "proxy_cache_use_stale error timeout invalid_header" used?
thanks again Igor,
-Payam
|
|
On Mon, Apr 06, 2009 at 10:46:24PM -0700, Payam Chychi wrote:
> 2009/4/6 Igor Sysoev < [hidden email]>:
> > On Mon, Apr 06, 2009 at 10:14:36PM -0700, Payam Chychi wrote:
> >
> >> Hi Guys,
> >>
> >> I was hoping someone could point out a document where it can teach me
> >> how to setup nginx + caching. I know that traditionally nginx did not
> >> have a native caching and it required you to run ncache or cachemem in
> >> order to perform caching of static content... but does nginx now allow
> >> basic static file caching without the use of any other 3rd app?
> >>
> >> Im trying to understand if nginx now has a native caching which would
> >> allow caching of static content. I dont want to get fancy in anyway, I
> >> simply want to allocate say 200mb of storage space to allow caching of
> >> static content. the 200mb should be updated with the most
> >> active/recently seen file request.
> >>
> >> reason? im trying to allow nginx to serve the static files from disk
> >> (if it has seen it previously) and not have to go back to the origin
> >> server every single time.
> >
> > Get the lastest nginx (0.7.50) and use
> >
> > proxy_cache_path /path/to/cache levels=1:2
> > keys_zone=one:10m
> > inactive=7d max_size=200m;
> >
> > proxy_temp_path /path/to/temp; # must be on the same filesystem
> > # as cache
> >
> > server {
> >
> > location / {
> > proxy_pass http://backend;> >
> > proxy_cache one;
> > proxy_cache_key backend$request_uri;
> > proxy_cache_valid 200 1h;
> > proxy_cache_use_stale error timeout invalid_header;
> > }
> >
> >
> >
> > --
> > Igor Sysoev
> > http://sysoev.ru/en/> >
> >
> proxy_cache_path /path/to/cache levels=1:2
> keys_zone=one:10m
> inactive=7d max_size=200m;
>
> proxy_temp_path /path/to/temp; # must be on the same filesystem
> # as cache
>
> server {
>
> location / {
> proxy_pass http://backend;>
> proxy_cache one;
> proxy_cache_key backend$request_uri;
> proxy_cache_valid 200 1h;
> proxy_cache_use_stale error timeout invalid_header;
> }
>
>
>
> few questions:
> 1- what does the keys_zone used for
> 2- what does the "200 1h" in proxy_cache_valid mean
> 3- how is the "proxy_cache_use_stale error timeout invalid_header" used?
http://wiki.nginx.org/NginxHttpProxyModule#proxy_cache--
Igor Sysoev
http://sysoev.ru/en/
|
|
thank you sir =) you are a king!
-Payam
2009/4/6 Igor Sysoev < [hidden email]>:
> On Mon, Apr 06, 2009 at 10:46:24PM -0700, Payam Chychi wrote:
>
>> 2009/4/6 Igor Sysoev < [hidden email]>:
>> > On Mon, Apr 06, 2009 at 10:14:36PM -0700, Payam Chychi wrote:
>> >
>> >> Hi Guys,
>> >>
>> >> I was hoping someone could point out a document where it can teach me
>> >> how to setup nginx + caching. I know that traditionally nginx did not
>> >> have a native caching and it required you to run ncache or cachemem in
>> >> order to perform caching of static content... but does nginx now allow
>> >> basic static file caching without the use of any other 3rd app?
>> >>
>> >> Im trying to understand if nginx now has a native caching which would
>> >> allow caching of static content. I dont want to get fancy in anyway, I
>> >> simply want to allocate say 200mb of storage space to allow caching of
>> >> static content. the 200mb should be updated with the most
>> >> active/recently seen file request.
>> >>
>> >> reason? im trying to allow nginx to serve the static files from disk
>> >> (if it has seen it previously) and not have to go back to the origin
>> >> server every single time.
>> >
>> > Get the lastest nginx (0.7.50) and use
>> >
>> > proxy_cache_path /path/to/cache levels=1:2
>> > keys_zone=one:10m
>> > inactive=7d max_size=200m;
>> >
>> > proxy_temp_path /path/to/temp; # must be on the same filesystem
>> > # as cache
>> >
>> > server {
>> >
>> > location / {
>> > proxy_pass http://backend;>> >
>> > proxy_cache one;
>> > proxy_cache_key backend$request_uri;
>> > proxy_cache_valid 200 1h;
>> > proxy_cache_use_stale error timeout invalid_header;
>> > }
>> >
>> >
>> >
>> > --
>> > Igor Sysoev
>> > http://sysoev.ru/en/>> >
>> >
>> proxy_cache_path /path/to/cache levels=1:2
>> keys_zone=one:10m
>> inactive=7d max_size=200m;
>>
>> proxy_temp_path /path/to/temp; # must be on the same filesystem
>> # as cache
>>
>> server {
>>
>> location / {
>> proxy_pass http://backend;>>
>> proxy_cache one;
>> proxy_cache_key backend$request_uri;
>> proxy_cache_valid 200 1h;
>> proxy_cache_use_stale error timeout invalid_header;
>> }
>>
>>
>>
>> few questions:
>> 1- what does the keys_zone used for
>> 2- what does the "200 1h" in proxy_cache_valid mean
>> 3- how is the "proxy_cache_use_stale error timeout invalid_header" used?
>
> http://wiki.nginx.org/NginxHttpProxyModule#proxy_cache>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/>
>
--
Payam Tarverdyan Chychi
Network Security Specialist / Network Engineer
|
|
On Mon, Apr 6, 2009 at 11:03 PM, Payam Chychi < [hidden email]> wrote:
> thank you sir =) you are a king!
>
> -Payam
>
> 2009/4/6 Igor Sysoev < [hidden email]>:
>> On Mon, Apr 06, 2009 at 10:46:24PM -0700, Payam Chychi wrote:
>>
>>> 2009/4/6 Igor Sysoev < [hidden email]>:
>>> > On Mon, Apr 06, 2009 at 10:14:36PM -0700, Payam Chychi wrote:
>>> >
>>> >> Hi Guys,
>>> >>
>>> >> I was hoping someone could point out a document where it can teach me
>>> >> how to setup nginx + caching. I know that traditionally nginx did not
>>> >> have a native caching and it required you to run ncache or cachemem in
>>> >> order to perform caching of static content... but does nginx now allow
>>> >> basic static file caching without the use of any other 3rd app?
>>> >>
>>> >> Im trying to understand if nginx now has a native caching which would
>>> >> allow caching of static content. I dont want to get fancy in anyway, I
>>> >> simply want to allocate say 200mb of storage space to allow caching of
>>> >> static content. the 200mb should be updated with the most
>>> >> active/recently seen file request.
>>> >>
>>> >> reason? im trying to allow nginx to serve the static files from disk
>>> >> (if it has seen it previously) and not have to go back to the origin
>>> >> server every single time.
>>> >
>>> > Get the lastest nginx (0.7.50) and use
>>> >
>>> > proxy_cache_path /path/to/cache levels=1:2
>>> > keys_zone=one:10m
>>> > inactive=7d max_size=200m;
>>> >
>>> > proxy_temp_path /path/to/temp; # must be on the same filesystem
>>> > # as cache
>>> >
>>> > server {
>>> >
>>> > location / {
>>> > proxy_pass http://backend;>>> >
>>> > proxy_cache one;
>>> > proxy_cache_key backend$request_uri;
>>> > proxy_cache_valid 200 1h;
>>> > proxy_cache_use_stale error timeout invalid_header;
>>> > }
>>> >
>>> >
>>> >
>>> > --
>>> > Igor Sysoev
>>> > http://sysoev.ru/en/>>> >
>>> >
>>> proxy_cache_path /path/to/cache levels=1:2
>>> keys_zone=one:10m
>>> inactive=7d max_size=200m;
>>>
>>> proxy_temp_path /path/to/temp; # must be on the same filesystem
>>> # as cache
>>>
>>> server {
>>>
>>> location / {
>>> proxy_pass http://backend;>>>
>>> proxy_cache one;
>>> proxy_cache_key backend$request_uri;
>>> proxy_cache_valid 200 1h;
>>> proxy_cache_use_stale error timeout invalid_header;
>>> }
>>>
>>>
>>>
>>> few questions:
>>> 1- what does the keys_zone used for
>>> 2- what does the "200 1h" in proxy_cache_valid mean
>>> 3- how is the "proxy_cache_use_stale error timeout invalid_header" used?
>>
>> http://wiki.nginx.org/NginxHttpProxyModule#proxy_cache>>
>>
>> --
>> Igor Sysoev
>> http://sysoev.ru/en/>>
>>
>
>
>
> --
> Payam Tarverdyan Chychi
> Network Security Specialist / Network Engineer
>
Igor,
using the caching info ... i get a "redirect loop" when trying to
download domain.com/images/spacer.gif when the file does not exist
on the origin server ... ive also been able replicate this with YSlow
for firefox
When bypassing the proxy/cache and connecting directly to the origin,
i get the proper 404 error
any ideas?
Thanks
|
|
On Tue, Apr 07, 2009 at 12:55:37AM -0700, Payam Chychi wrote:
> On Mon, Apr 6, 2009 at 11:03 PM, Payam Chychi < [hidden email]> wrote:
> > thank you sir =) you are a king!
> >
> > -Payam
> >
> > 2009/4/6 Igor Sysoev < [hidden email]>:
> >> On Mon, Apr 06, 2009 at 10:46:24PM -0700, Payam Chychi wrote:
> >>
> >>> 2009/4/6 Igor Sysoev < [hidden email]>:
> >>> > On Mon, Apr 06, 2009 at 10:14:36PM -0700, Payam Chychi wrote:
> >>> >
> >>> >> Hi Guys,
> >>> >>
> >>> >> I was hoping someone could point out a document where it can teach me
> >>> >> how to setup nginx + caching. I know that traditionally nginx did not
> >>> >> have a native caching and it required you to run ncache or cachemem in
> >>> >> order to perform caching of static content... but does nginx now allow
> >>> >> basic static file caching without the use of any other 3rd app?
> >>> >>
> >>> >> Im trying to understand if nginx now has a native caching which would
> >>> >> allow caching of static content. I dont want to get fancy in anyway, I
> >>> >> simply want to allocate say 200mb of storage space to allow caching of
> >>> >> static content. the 200mb should be updated with the most
> >>> >> active/recently seen file request.
> >>> >>
> >>> >> reason? im trying to allow nginx to serve the static files from disk
> >>> >> (if it has seen it previously) and not have to go back to the origin
> >>> >> server every single time.
> >>> >
> >>> > Get the lastest nginx (0.7.50) and use
> >>> >
> >>> > proxy_cache_path /path/to/cache levels=1:2
> >>> > keys_zone=one:10m
> >>> > inactive=7d max_size=200m;
> >>> >
> >>> > proxy_temp_path /path/to/temp; # must be on the same filesystem
> >>> > # as cache
> >>> >
> >>> > server {
> >>> >
> >>> > location / {
> >>> > proxy_pass http://backend;> >>> >
> >>> > proxy_cache one;
> >>> > proxy_cache_key backend$request_uri;
> >>> > proxy_cache_valid 200 1h;
> >>> > proxy_cache_use_stale error timeout invalid_header;
> >>> > }
> >>> >
> >>> >
> >>> >
> >>> > --
> >>> > Igor Sysoev
> >>> > http://sysoev.ru/en/> >>> >
> >>> >
> >>> proxy_cache_path /path/to/cache levels=1:2
> >>> keys_zone=one:10m
> >>> inactive=7d max_size=200m;
> >>>
> >>> proxy_temp_path /path/to/temp; # must be on the same filesystem
> >>> # as cache
> >>>
> >>> server {
> >>>
> >>> location / {
> >>> proxy_pass http://backend;> >>>
> >>> proxy_cache one;
> >>> proxy_cache_key backend$request_uri;
> >>> proxy_cache_valid 200 1h;
> >>> proxy_cache_use_stale error timeout invalid_header;
> >>> }
> >>>
> >>>
> >>>
> >>> few questions:
> >>> 1- what does the keys_zone used for
> >>> 2- what does the "200 1h" in proxy_cache_valid mean
> >>> 3- how is the "proxy_cache_use_stale error timeout invalid_header" used?
> >>
> >> http://wiki.nginx.org/NginxHttpProxyModule#proxy_cache> >>
> >>
> >> --
> >> Igor Sysoev
> >> http://sysoev.ru/en/> >>
> >>
> >
> >
> >
> > --
> > Payam Tarverdyan Chychi
> > Network Security Specialist / Network Engineer
> >
>
>
> Igor,
>
> using the caching info ... i get a "redirect loop" when trying to
> download domain.com/images/spacer.gif when the file does not exist
> on the origin server ... ive also been able replicate this with YSlow
> for firefox
>
> When bypassing the proxy/cache and connecting directly to the origin,
> i get the proper 404 error
> any ideas?
Probably you have something like
error_page 404 /404.html;
proxy_intercept_errors on;
recursive_error_pages on;
without
location = /404.html {
so the /404.html is proxied to backend again.
Also you may cache 404 errors too:
proxy_cache_valid 200 1h;
proxy_cache_valid 404 5m;
--
Igor Sysoev
http://sysoev.ru/en/
|
|
2009/4/7 Igor Sysoev < [hidden email]>:
> On Tue, Apr 07, 2009 at 12:55:37AM -0700, Payam Chychi wrote:
>
>> On Mon, Apr 6, 2009 at 11:03 PM, Payam Chychi < [hidden email]> wrote:
>> > thank you sir =) you are a king!
>> >
>> > -Payam
>> >
>> > 2009/4/6 Igor Sysoev < [hidden email]>:
>> >> On Mon, Apr 06, 2009 at 10:46:24PM -0700, Payam Chychi wrote:
>> >>
>> >>> 2009/4/6 Igor Sysoev < [hidden email]>:
>> >>> > On Mon, Apr 06, 2009 at 10:14:36PM -0700, Payam Chychi wrote:
>> >>> >
>> >>> >> Hi Guys,
>> >>> >>
>> >>> >> I was hoping someone could point out a document where it can teach me
>> >>> >> how to setup nginx + caching. I know that traditionally nginx did not
>> >>> >> have a native caching and it required you to run ncache or cachemem in
>> >>> >> order to perform caching of static content... but does nginx now allow
>> >>> >> basic static file caching without the use of any other 3rd app?
>> >>> >>
>> >>> >> Im trying to understand if nginx now has a native caching which would
>> >>> >> allow caching of static content. I dont want to get fancy in anyway, I
>> >>> >> simply want to allocate say 200mb of storage space to allow caching of
>> >>> >> static content. the 200mb should be updated with the most
>> >>> >> active/recently seen file request.
>> >>> >>
>> >>> >> reason? im trying to allow nginx to serve the static files from disk
>> >>> >> (if it has seen it previously) and not have to go back to the origin
>> >>> >> server every single time.
>> >>> >
>> >>> > Get the lastest nginx (0.7.50) and use
>> >>> >
>> >>> > proxy_cache_path /path/to/cache levels=1:2
>> >>> > keys_zone=one:10m
>> >>> > inactive=7d max_size=200m;
>> >>> >
>> >>> > proxy_temp_path /path/to/temp; # must be on the same filesystem
>> >>> > # as cache
>> >>> >
>> >>> > server {
>> >>> >
>> >>> > location / {
>> >>> > proxy_pass http://backend;>> >>> >
>> >>> > proxy_cache one;
>> >>> > proxy_cache_key backend$request_uri;
>> >>> > proxy_cache_valid 200 1h;
>> >>> > proxy_cache_use_stale error timeout invalid_header;
>> >>> > }
>> >>> >
>> >>> >
>> >>> >
>> >>> > --
>> >>> > Igor Sysoev
>> >>> > http://sysoev.ru/en/>> >>> >
>> >>> >
>> >>> proxy_cache_path /path/to/cache levels=1:2
>> >>> keys_zone=one:10m
>> >>> inactive=7d max_size=200m;
>> >>>
>> >>> proxy_temp_path /path/to/temp; # must be on the same filesystem
>> >>> # as cache
>> >>>
>> >>> server {
>> >>>
>> >>> location / {
>> >>> proxy_pass http://backend;>> >>>
>> >>> proxy_cache one;
>> >>> proxy_cache_key backend$request_uri;
>> >>> proxy_cache_valid 200 1h;
>> >>> proxy_cache_use_stale error timeout invalid_header;
>> >>> }
>> >>>
>> >>>
>> >>>
>> >>> few questions:
>> >>> 1- what does the keys_zone used for
>> >>> 2- what does the "200 1h" in proxy_cache_valid mean
>> >>> 3- how is the "proxy_cache_use_stale error timeout invalid_header" used?
>> >>
>> >> http://wiki.nginx.org/NginxHttpProxyModule#proxy_cache>> >>
>> >>
>> >> --
>> >> Igor Sysoev
>> >> http://sysoev.ru/en/>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > Payam Tarverdyan Chychi
>> > Network Security Specialist / Network Engineer
>> >
>>
>>
>> Igor,
>>
>> using the caching info ... i get a "redirect loop" when trying to
>> download domain.com/images/spacer.gif when the file does not exist
>> on the origin server ... ive also been able replicate this with YSlow
>> for firefox
>>
>> When bypassing the proxy/cache and connecting directly to the origin,
>> i get the proper 404 error
>> any ideas?
>
> Probably you have something like
>
> error_page 404 /404.html;
> proxy_intercept_errors on;
> recursive_error_pages on;
>
> without
>
> location = /404.html {
>
> so the /404.html is proxied to backend again.
>
> Also you may cache 404 errors too:
>
> proxy_cache_valid 200 1h;
> proxy_cache_valid 404 5m;
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/>
>
Right on... that was the problem. fixed with adding exactly what you
said... im now also caching 404
thanks again
-payam
|
|
www.ncache.org
an nginx cache module
maybe this can help u . On Tue, Apr 7, 2009 at 5:03 PM, Payam Chychi <[hidden email]> wrote:
2009/4/7 Igor Sysoev <[hidden email]>:
> On Tue, Apr 07, 2009 at 12:55:37AM -0700, Payam Chychi wrote:
>
>> On Mon, Apr 6, 2009 at 11:03 PM, Payam Chychi < [hidden email]> wrote:
>> > thank you sir =) you are a king!
>> >
>> > -Payam
>> >
>> > 2009/4/6 Igor Sysoev < [hidden email]>:
>> >> On Mon, Apr 06, 2009 at 10:46:24PM -0700, Payam Chychi wrote:
>> >>
>> >>> 2009/4/6 Igor Sysoev < [hidden email]>:
>> >>> > On Mon, Apr 06, 2009 at 10:14:36PM -0700, Payam Chychi wrote:
>> >>> >
>> >>> >> Hi Guys,
>> >>> >>
>> >>> >> I was hoping someone could point out a document where it can teach me
>> >>> >> how to setup nginx + caching. I know that traditionally nginx did not
>> >>> >> have a native caching and it required you to run ncache or cachemem in
>> >>> >> order to perform caching of static content... but does nginx now allow
>> >>> >> basic static file caching without the use of any other 3rd app?
>> >>> >>
>> >>> >> Im trying to understand if nginx now has a native caching which would
>> >>> >> allow caching of static content. I dont want to get fancy in anyway, I
>> >>> >> simply want to allocate say 200mb of storage space to allow caching of
>> >>> >> static content. the 200mb should be updated with the most
>> >>> >> active/recently seen file request.
>> >>> >>
>> >>> >> reason? im trying to allow nginx to serve the static files from disk
>> >>> >> (if it has seen it previously) and not have to go back to the origin
>> >>> >> server every single time.
>> >>> >
>> >>> > Get the lastest nginx (0.7.50) and use
>> >>> >
>> >>> > proxy_cache_path /path/to/cache levels=1:2
>> >>> > keys_zone=one:10m
>> >>> > inactive=7d max_size=200m;
>> >>> >
>> >>> > proxy_temp_path /path/to/temp; # must be on the same filesystem
>> >>> > # as cache
>> >>> >
>> >>> > server {
>> >>> >
>> >>> > location / {
>> >>> > proxy_pass http://backend;
>> >>> >
>> >>> > proxy_cache one;
>> >>> > proxy_cache_key backend$request_uri;
>> >>> > proxy_cache_valid 200 1h;
>> >>> > proxy_cache_use_stale error timeout invalid_header;
>> >>> > }
>> >>> >
>> >>> >
>> >>> >
>> >>> > --
>> >>> > Igor Sysoev
>> >>> > http://sysoev.ru/en/
>> >>> >
>> >>> >
>> >>> proxy_cache_path /path/to/cache levels=1:2
>> >>> keys_zone=one:10m
>> >>> inactive=7d max_size=200m;
>> >>>
>> >>> proxy_temp_path /path/to/temp; # must be on the same filesystem
>> >>> # as cache
>> >>>
>> >>> server {
>> >>>
>> >>> location / {
>> >>> proxy_pass http://backend;
>> >>>
>> >>> proxy_cache one;
>> >>> proxy_cache_key backend$request_uri;
>> >>> proxy_cache_valid 200 1h;
>> >>> proxy_cache_use_stale error timeout invalid_header;
>> >>> }
>> >>>
>> >>>
>> >>>
>> >>> few questions:
>> >>> 1- what does the keys_zone used for
>> >>> 2- what does the "200 1h" in proxy_cache_valid mean
>> >>> 3- how is the "proxy_cache_use_stale error timeout invalid_header" used?
>> >>
>> >> http://wiki.nginx.org/NginxHttpProxyModule#proxy_cache
>> >>
>> >>
>> >> --
>> >> Igor Sysoev
>> >> http://sysoev.ru/en/
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > Payam Tarverdyan Chychi
>> > Network Security Specialist / Network Engineer
>> >
>>
>>
>> Igor,
>>
>> using the caching info ... i get a "redirect loop" when trying to
>> download domain.com/images/spacer.gif when the file does not exist
>> on the origin server ... ive also been able replicate this with YSlow
>> for firefox
>>
>> When bypassing the proxy/cache and connecting directly to the origin,
>> i get the proper 404 error
>> any ideas?
>
> Probably you have something like
>
> error_page 404 /404.html;
> proxy_intercept_errors on;
> recursive_error_pages on;
>
> without
>
> location = /404.html {
>
> so the /404.html is proxied to backend again.
>
> Also you may cache 404 errors too:
>
> proxy_cache_valid 200 1h;
> proxy_cache_valid 404 5m;
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>
>
Right on... that was the problem. fixed with adding exactly what you
said... im now also caching 404
thanks again
-payam
|
|
Dear Igor,
Then, how to use proxy_cache WITH flv streaming?
I tried proxy_cache feature, but it seems that the flv streaming function does not work with proxy_cache.
Thanks
Best Regard,
Peng Wu
2009-04-08
On Mon, Apr 06, 2009 at 10:14:36PM -0700, Payam Chychi wrote:
> Hi Guys,
>
> I was hoping someone could point out a document where it can teach me
> how to setup nginx + caching. I know that traditionally nginx did not
> have a native caching and it required you to run ncache or cachemem in
> order to perform caching of static content... but does nginx now allow
> basic static file caching without the use of any other 3rd app?
>
> Im trying to understand if nginx now has a native caching which would
> allow caching of static content. I dont want to get fancy in anyway, I
> simply want to allocate say 200mb of storage space to allow caching of
> static content. the 200mb should be updated with the most
> active/recently seen file request.
>
> reason? im trying to allow nginx to serve the static files from disk
> (if it has seen it previously) and not have to go back to the origin
> server every single time.
Get the lastest nginx (0.7.50) and use
proxy_cache_path /path/to/cache levels=1:2
keys_zone=one:10m
inactive=7d max_size=200m;
proxy_temp_path /path/to/temp; # must be on the same filesystem
# as cache
server {
location / {
proxy_pass http://backend; proxy_cache one;
proxy_cache_key backend$request_uri;
proxy_cache_valid 200 1h;
proxy_cache_use_stale error timeout invalid_header;
}
--
Igor Sysoev
http://sysoev.ru/en/
|
|
On Wed, Apr 08, 2009 at 10:51:59AM +0800, ???? wrote:
> Dear Igor,
>
> Then, how to use proxy_cache WITH flv streaming?
> I tried proxy_cache feature, but it seems that the flv streaming function does not work with proxy_cache.
No, flv is not filter, but handler, thefore it's not possible.
--
Igor Sysoev
http://sysoev.ru/en/
|
|
How about jpg, css, js or any other files?
------Original Message------
From: Igor Sysoev
Sender: [hidden email]
To: [hidden email]
ReplyTo: [hidden email]
Subject: Re: Re: nginx + caching of static files
Sent: Apr 8, 2009 6:04 PM
On Wed, Apr 08, 2009 at 10:51:59AM +0800, ???? wrote:
> Dear Igor,
>
> Then, how to use proxy_cache WITH flv streaming?
> I tried proxy_cache feature, but it seems that the flv streaming function does not work with proxy_cache.
No, flv is not filter, but handler, thefore it's not possible.
--
Igor Sysoev
http://sysoev.ru/en/Best Regards,
Glen Lumanau
-
Sent from my BlackBerry®
|
|
On Wed, Apr 08, 2009 at 11:16:30AM +0000, Glen Lumanau wrote:
> How about jpg, css, js or any other files?
No problems with these files. Actually, there are no problems with flv
itself. The issue is when you want to get /some.flv?start=5000.
However, it seems flv handler can be converted easy enough to filter.
> ------Original Message------
> From: Igor Sysoev
> Sender: [hidden email]
> To: [hidden email]
> ReplyTo: [hidden email]
> Subject: Re: Re: nginx + caching of static files
> Sent: Apr 8, 2009 6:04 PM
>
> On Wed, Apr 08, 2009 at 10:51:59AM +0800, ???? wrote:
>
> > Dear Igor,
> >
> > Then, how to use proxy_cache WITH flv streaming?
> > I tried proxy_cache feature, but it seems that the flv streaming function does not work with proxy_cache.
>
> No, flv is not filter, but handler, thefore it's not possible.
--
Igor Sysoev
http://sysoev.ru/en/
|
|
shinepf
ncache will only compile with versions up to 0.7.43.
with newer once there is a compile error because of the change in
ngx_http_cache_s structure.
are You going to fix anytime soon?
--
Best Regards
Tomasz Pajor
> www.ncache.org < http://www.ncache.org>
>
> an nginx cache module
>
> maybe this can help u .
>
> On Tue, Apr 7, 2009 at 5:03 PM, Payam Chychi < [hidden email]
> <mailto: [hidden email]>> wrote:
>
> 2009/4/7 Igor Sysoev < [hidden email] <mailto: [hidden email]>>:
> > On Tue, Apr 07, 2009 at 12:55:37AM -0700, Payam Chychi wrote:
> >
> >> On Mon, Apr 6, 2009 at 11:03 PM, Payam Chychi
> < [hidden email] <mailto: [hidden email]>> wrote:
> >> > thank you sir =) you are a king!
> >> >
> >> > -Payam
> >> >
> >> > 2009/4/6 Igor Sysoev < [hidden email]
> <mailto: [hidden email]>>:
> >> >> On Mon, Apr 06, 2009 at 10:46:24PM -0700, Payam Chychi wrote:
> >> >>
> >> >>> 2009/4/6 Igor Sysoev < [hidden email]
> <mailto: [hidden email]>>:
> >> >>> > On Mon, Apr 06, 2009 at 10:14:36PM -0700, Payam Chychi wrote:
> >> >>> >
> >> >>> >> Hi Guys,
> >> >>> >>
> >> >>> >> I was hoping someone could point out a document where it
> can teach me
> >> >>> >> how to setup nginx + caching. I know that traditionally
> nginx did not
> >> >>> >> have a native caching and it required you to run ncache
> or cachemem in
> >> >>> >> order to perform caching of static content... but does
> nginx now allow
> >> >>> >> basic static file caching without the use of any other
> 3rd app?
> >> >>> >>
> >> >>> >> Im trying to understand if nginx now has a native
> caching which would
> >> >>> >> allow caching of static content. I dont want to get
> fancy in anyway, I
> >> >>> >> simply want to allocate say 200mb of storage space to
> allow caching of
> >> >>> >> static content. the 200mb should be updated with the most
> >> >>> >> active/recently seen file request.
> >> >>> >>
> >> >>> >> reason? im trying to allow nginx to serve the static
> files from disk
> >> >>> >> (if it has seen it previously) and not have to go back
> to the origin
> >> >>> >> server every single time.
> >> >>> >
> >> >>> > Get the lastest nginx (0.7.50) and use
> >> >>> >
> >> >>> > proxy_cache_path /path/to/cache levels=1:2
> >> >>> > keys_zone=one:10m
> >> >>> > inactive=7d max_size=200m;
> >> >>> >
> >> >>> > proxy_temp_path /path/to/temp; # must be on the
> same filesystem
> >> >>> > # as cache
> >> >>> >
> >> >>> > server {
> >> >>> >
> >> >>> > location / {
> >> >>> > proxy_pass http://backend;> >> >>> >
> >> >>> > proxy_cache one;
> >> >>> > proxy_cache_key backend$request_uri;
> >> >>> > proxy_cache_valid 200 1h;
> >> >>> > proxy_cache_use_stale error timeout
> invalid_header;
> >> >>> > }
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> > --
> >> >>> > Igor Sysoev
> >> >>> > http://sysoev.ru/en/> >> >>> >
> >> >>> >
> >> >>> proxy_cache_path /path/to/cache levels=1:2
> >> >>> keys_zone=one:10m
> >> >>> inactive=7d max_size=200m;
> >> >>>
> >> >>> proxy_temp_path /path/to/temp; # must be on the same
> filesystem
> >> >>> # as cache
> >> >>>
> >> >>> server {
> >> >>>
> >> >>> location / {
> >> >>> proxy_pass http://backend;> >> >>>
> >> >>> proxy_cache one;
> >> >>> proxy_cache_key backend$request_uri;
> >> >>> proxy_cache_valid 200 1h;
> >> >>> proxy_cache_use_stale error timeout
> invalid_header;
> >> >>> }
> >> >>>
> >> >>>
> >> >>>
> >> >>> few questions:
> >> >>> 1- what does the keys_zone used for
> >> >>> 2- what does the "200 1h" in proxy_cache_valid mean
> >> >>> 3- how is the "proxy_cache_use_stale error timeout
> invalid_header" used?
> >> >>
> >> >> http://wiki.nginx.org/NginxHttpProxyModule#proxy_cache> >> >>
> >> >>
> >> >> --
> >> >> Igor Sysoev
> >> >> http://sysoev.ru/en/> >> >>
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > Payam Tarverdyan Chychi
> >> > Network Security Specialist / Network Engineer
> >> >
> >>
> >>
> >> Igor,
> >>
> >> using the caching info ... i get a "redirect loop" when trying to
> >> download domain.com/images/spacer.gif
> < http://domain.com/images/spacer.gif> when the file does not exist
> >> on the origin server ... ive also been able replicate this with
> YSlow
> >> for firefox
> >>
> >> When bypassing the proxy/cache and connecting directly to the
> origin,
> >> i get the proper 404 error
> >> any ideas?
> >
> > Probably you have something like
> >
> > error_page 404 /404.html;
> > proxy_intercept_errors on;
> > recursive_error_pages on;
> >
> > without
> >
> > location = /404.html {
> >
> > so the /404.html is proxied to backend again.
> >
> > Also you may cache 404 errors too:
> >
> > proxy_cache_valid 200 1h;
> > proxy_cache_valid 404 5m;
> >
> >
> > --
> > Igor Sysoev
> > http://sysoev.ru/en/> >
> >
>
> Right on... that was the problem. fixed with adding exactly what you
> said... im now also caching 404
>
> thanks again
> -payam
>
>
|
|
Hello!
On Wed, Apr 08, 2009 at 03:18:18PM +0400, Igor Sysoev wrote:
> On Wed, Apr 08, 2009 at 11:16:30AM +0000, Glen Lumanau wrote:
>
> > How about jpg, css, js or any other files?
>
> No problems with these files. Actually, there are no problems with flv
> itself. The issue is when you want to get /some.flv?start=5000.
> However, it seems flv handler can be converted easy enough to filter.
I wrote generic bytes filter some time ago, and as far as I
understand it may be used for .flv streaming with some trivial
rewrites. I've never tried though.
http://mdounin.ru/hg/ngx_http_bytes_filter_module/http://mdounin.ru/hg/ngx_http_bytes_filter_module/raw-file/tip/READMEMaxim Dounin
>
> > ------Original Message------
> > From: Igor Sysoev
> > Sender: [hidden email]
> > To: [hidden email]
> > ReplyTo: [hidden email]
> > Subject: Re: Re: nginx + caching of static files
> > Sent: Apr 8, 2009 6:04 PM
> >
> > On Wed, Apr 08, 2009 at 10:51:59AM +0800, ???? wrote:
> >
> > > Dear Igor,
> > >
> > > Then, how to use proxy_cache WITH flv streaming?
> > > I tried proxy_cache feature, but it seems that the flv streaming function does not work with proxy_cache.
> >
> > No, flv is not filter, but handler, thefore it's not possible.
>
>
> --
> Igor Sysoev
> http://sysoev.ru/en/>
|
|
Hi Igor (and everyone else),
I had a few quick questions about the new proxy_cache feature, and I
apologize if they have already been answered.
1) What about query_strings? Does proxy_cache ignore or include
query_strings? Is there a way to have it ignore query_strings in the URL?
2) How scalable is this system? Could it handle 50 million different
URIs for instance?
3) Any plans for purge capabilities somehow, in the event you need the
content flushed right away?
Keep up the great work, thanks for making the world's best server!
Thanks,
John
Igor Sysoev wrote:
> On Wed, Apr 08, 2009 at 11:16:30AM +0000, Glen Lumanau wrote:
>
>
>> How about jpg, css, js or any other files?
>>
>
> No problems with these files. Actually, there are no problems with flv
> itself. The issue is when you want to get /some.flv?start=5000.
> However, it seems flv handler can be converted easy enough to filter.
>
>
>> ------Original Message------
>> From: Igor Sysoev
>> Sender: [hidden email]
>> To: [hidden email]
>> ReplyTo: [hidden email]
>> Subject: Re: Re: nginx + caching of static files
>> Sent: Apr 8, 2009 6:04 PM
>>
>> On Wed, Apr 08, 2009 at 10:51:59AM +0800, ???? wrote:
>>
>>
>>> Dear Igor,
>>>
>>> Then, how to use proxy_cache WITH flv streaming?
>>> I tried proxy_cache feature, but it seems that the flv streaming function does not work with proxy_cache.
>>>
>> No, flv is not filter, but handler, thefore it's not possible.
>>
>
>
>
|
|
On Thu, Apr 09, 2009 at 02:27:15PM -0500, Resicow wrote:
> Hi Igor (and everyone else),
>
> I had a few quick questions about the new proxy_cache feature, and I
> apologize if they have already been answered.
>
> 1) What about query_strings? Does proxy_cache ignore or include
> query_strings? Is there a way to have it ignore query_strings in the URL?
By default qeury strings are included. You may ignore them using something
like this:
proxy_cache_key $host/$uri";
The default proxy_cache_key approximates
proxy_cache_key $scheme$proxy_host$uri$is_args$args;
> 2) How scalable is this system? Could it handle 50 million different
> URIs for instance?
Each key takes 128 bytes in shared memory zone. Therefore you need 6.1G zone:
key_zone=NAME:6200m;
> 3) Any plans for purge capabilities somehow, in the event you need the
> content flushed right away?
Yes, there are such plans.
> Keep up the great work, thanks for making the world's best server!
>
> Thanks,
>
> John
>
>
>
>
>
> Igor Sysoev wrote:
> >On Wed, Apr 08, 2009 at 11:16:30AM +0000, Glen Lumanau wrote:
> >
> >
> >>How about jpg, css, js or any other files?
> >>
> >
> >No problems with these files. Actually, there are no problems with flv
> >itself. The issue is when you want to get /some.flv?start=5000.
> >However, it seems flv handler can be converted easy enough to filter.
> >
> >
> >>------Original Message------
> >>From: Igor Sysoev
> >>Sender: [hidden email]
> >>To: [hidden email]
> >>ReplyTo: [hidden email]
> >>Subject: Re: Re: nginx + caching of static files
> >>Sent: Apr 8, 2009 6:04 PM
> >>
> >>On Wed, Apr 08, 2009 at 10:51:59AM +0800, ???? wrote:
> >>
> >>
> >>>Dear Igor,
> >>>
> >>>Then, how to use proxy_cache WITH flv streaming?
> >>>I tried proxy_cache feature, but it seems that the flv streaming
> >>>function does not work with proxy_cache.
> >>>
> >>No, flv is not filter, but handler, thefore it's not possible.
> >>
> >
> >
> >
>
--
Igor Sysoev
http://sysoev.ru/en/
|
|
On Fri, Apr 10, 2009 at 04:48:25AM -0400, yangguangli wrote:
> ?????????????????????
No.
--
Igor Sysoev
http://sysoev.ru/en/
|
|
At Fri, 10 Apr 2009 04:48:25 -0400,
"yangguangli" < [hidden email]> wrote:
>
> 汉语能看懂不?
>
Yes, chines don't understand lot of peoples from this maillist. Please
use english.
--
wbr, Kirill
|
12
|