Welcome! Log In Create A New Profile

Advanced

Re: proxy_cache ramdisk

Igor Sysoev
February 01, 2010 12:40PM
On Mon, Feb 01, 2010 at 11:26:23AM -0600, AMP Admin wrote:

> -----Original Message-----
> From: Igor Sysoev [mailto:igor@sysoev.ru]
> Sent: Monday, February 01, 2010 11:06 AM
> To: nginx@nginx.org
> Subject: Re: proxy_cache ramdisk
>
> On Mon, Feb 01, 2010 at 10:50:37AM -0600, AMP Admin wrote:
>
> > -----Original Message-----
> > From: Igor Sysoev [mailto:igor@sysoev.ru]
> > Sent: Monday, February 01, 2010 10:38 AM
> > To: nginx@nginx.org
> > Subject: Re: proxy_cache ramdisk
> >
> > On Sun, Jan 31, 2010 at 04:26:05PM -0600, AMP Admin wrote:
> >
> > > I'm able to cache php pages with the following but I can't seem to cache
> > > static images with proxy_cache.
> > >
> > >
> > > This works:
> > >
> > > location ~ \.php$ {
> > >
> > > fastcgi_index index.php;
> > > fastcgi_pass 127.0.0.1:9000;
> > > fastcgi_cache cachephp;
> > > fastcgi_cache_key 127.0.0.1:9000$request_uri;
> > > fastcgi_cache_valid 200 1h;
> > > include fastcgi_params;
> > > fastcgi_intercept_errors On;
> > > fastcgi_ignore_client_abort On;
> >
> > "On" are invalid parameters.
> >
> > > fastcgi_buffer_size 128k;
> > > fastcgi_buffers 4 128k;
> > > }
> > >
> > >
> > >
> > > This does not work:
> > >
> > > location ~* \.(jpg|jpeg|gif|css|png|js|ico|tif)$ {
> > > access_log off;
> > > expires 30d;
> > > proxy_pass http://127.0.0.1;
> > > proxy_cache_key $scheme$host$request_uri
> > > proxy_cache cachestatic;
> > > proxy_cache_valid 200 1h;
> > > proxy_cache_valid 404 5m;
> >
> > Why do you want to cache image from localhost ?
> > You should handle them as static files.
> >
> > > break;
> > > }
> >
> > "break" is useless here. It's just waste of CPU cycles.
> >
> >
> > --------
> >
> > So I should just really just use cache like this:
> > location ~ \.php$ {
> >
> > fastcgi_index index.php;
> > fastcgi_pass 127.0.0.1:9000;
> > fastcgi_cache cachephp;
> > fastcgi_cache_key 127.0.0.1:9000$request_uri;
> > fastcgi_cache_valid 200 1h;
> > include fastcgi_params;
> > }
> >
> > And images like this:
> > location ~* \.(jpg|jpeg|gif|css|png|js|ico|tif)$ {
> > access_log off;
> > expires 30d;
> > }
> >
> > That would be best for performance?
>
> Yes.
>
> > Also, I noticed when I use the fastcgi_cache above that it caches logged
> in
> > pages and users see the wrong user profile... should I change the
> > fastcgi_cache_key to fix that?
>
> Yes. Probably, you may add an user cookie.
> Actually, you should mark logged pages as non-cachable, otherwise transient
> proxy servers may cache them as well.
>
> ------------------------
>
> All pages on this site have a login option so I guess caching our site isn't
> a good idea.

Yes, even if you cache them properly in nginx, they will have poor hit ratio.
However, you may try to cache non-personalized pages.


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

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

proxy_cache ramdisk

testbot January 29, 2010 11:48AM

RE: proxy_cache ramdisk

testbot January 30, 2010 01:50PM

RE: proxy_cache ramdisk

testbot January 31, 2010 05:30PM

Re: proxy_cache ramdisk

Igor Sysoev February 01, 2010 11:40AM

RE: proxy_cache ramdisk

testbot February 01, 2010 11:54AM

Re: proxy_cache ramdisk

Igor Sysoev February 01, 2010 12:10PM

RE: proxy_cache ramdisk

testbot February 01, 2010 12:30PM

Re: proxy_cache ramdisk

Igor Sysoev February 01, 2010 12:40PM

Re: proxy_cache ramdisk

Ryan Malayter February 02, 2010 09:48AM

RE: proxy_cache ramdisk

testbot February 02, 2010 12:58PM

Re: proxy_cache ramdisk

Ryan Malayter January 31, 2010 10:08PM

Re: proxy_cache ramdisk

nexthop January 31, 2010 10:14PM

Re: proxy_cache ramdisk

Ryan Malayter February 01, 2010 09:20AM

RE: proxy_cache ramdisk

testbot February 01, 2010 11:04AM

Re: proxy_cache ramdisk

Ryan Malayter February 01, 2010 05:50PM

RE: proxy_cache ramdisk

testbot February 01, 2010 11:10AM

RE: proxy_cache ramdisk

danny February 01, 2010 11:22AM

Re: proxy_cache ramdisk

Akins, Brian February 01, 2010 08:04AM

Re: proxy_cache ramdisk

Igor Sysoev February 01, 2010 11:42AM

Re: proxy_cache ramdisk

nexthop February 01, 2010 12:24PM

Re: proxy_cache ramdisk

Igor Sysoev February 01, 2010 12:36PM

Re: proxy_cache ramdisk

nexthop February 01, 2010 08:58PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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