Can't make nginx to cache

Maxim Dounin mdounin at mdounin.ru
Thu Jul 23 17:15:47 MSD 2009


Hello!

On Thu, Jul 23, 2009 at 02:52:05PM +0200, Mirosław Jaworski wrote:

[...]

> Direct connect to backend:
> 
> $ telnet 192.168.10.18 80
> Trying 192.168.10.18...
> Connected to 192.168.10.18.
> Escape character is '^]'.
> GET /test.html HTTP/1.1
> Host: www.xyz.pl
> 
> HTTP/1.1 200 OK
> Date: Thu, 23 Jul 2009 11:52:23 GMT
> Server: Apache/2.2.9 (Ubuntu) PHP/5.2.6-2ubuntu4.2 with Suhosin-Patch
> mod_ssl/2.2.9 OpenSSL/0.9.8g
> Last-Modified: Thu, 23 Jul 2009 11:52:10 GMT
> ETag: "cca18-5-46f5e1e220e80"
> Accept-Ranges: bytes
> Content-Length: 5
> Vary: Accept-Encoding
> Content-Type: text/html

[...]

There is no cache control headers in backend reply (Expires, 
Cache-Control, X-Accel-Expires), so you have to explicitly specify 
time to cache various replies via proxy_cache_valid directive.

See http://wiki.nginx.org/NginxHttpProxyModule#proxy_cache_valid  
for details.

Maxim Dounin





More information about the nginx mailing list