Welcome! Log In Create A New Profile

Advanced

Re: PHP-FPM no cache

Maxim Dounin
July 04, 2011 05:02AM
Hello!

On Mon, Jul 04, 2011 at 02:11:11AM -0500, HTF wrote:

> Hello,
>
> I've enabled caching on php scripts as below but it looks like the
> server is not caching at all:
>
> http {
> fastcgi_cache_path /tmp/cache levels=1:2
> keys_zone=tmp:10m
> inactive=5m;
>
> server {
> location / {
> ...
> fastcgi_cache tmp;
> fastcgi_cache_valid any 1h;
> fastcgi_cache_min_uses 1;
> ...
> }
> }
> }
>
> - but the caching directory is totally empty (nginx has write privileges
> as it was created by nginx itself during reload)
> - I haven't noticed any performance improvements by running apache
> benchmark from different machine

Check your php responses, most likely they disable cache: nginx
honors Cache-Control, Expires headers, and additionally it will
disable cache if it sees Set-Cookie header in response. This
behaviour may be overwritten if desired with
fastcgi_cache_ignore_headers directive, see here:

http://wiki.nginx.org/HttpFcgiModule#fastcgi_ignore_headers

Note though that it's not generally safe as it may cause private
pages (and/or cookies) to be cached and returned to other clients.
Handle with care.

Maxim Dounin

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

PHP-FPM no cache

HTF July 04, 2011 03:11AM

Re: PHP-FPM no cache

Maxim Dounin July 04, 2011 05:02AM

Re: PHP-FPM no cache

HTF July 05, 2011 02:48AM

Re: PHP-FPM no cache

Maxim Dounin July 05, 2011 05:22AM

Re: PHP-FPM no cache

HTF July 06, 2011 02:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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