Problems getting NginX to cache
Mike
nginx at norgie.net
Sat Mar 27 15:40:28 MSK 2010
Folks,
I've been trying to setup NginX as a frontend cache for a webserver.
This is rather challenging, as the documentation is a little flakey but
it does look like it should be fairly straight forward. The reverse
proxing is working just fine, it just doesn't cache anything. This is
on version nginx version: nginx/0.7.65
I have added the following to the http {} section:
proxy_buffering on;
proxy_cache_valid any 10m;
proxy_cache_path /var/www/cache levels=1:2 keys_zone=my-cache:8m
max_size=1000m inactive=600m;
proxy_temp_path /var/www/tmp;
proxy_buffer_size 4k;
proxy_buffers 100 8k;
The following to server {}:
proxy_buffering on;
proxy_store on;
proxy_store_access user:rw group:rw all:r;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
And the following to location {}:
proxy_cache my-cache;
proxy_cache_valid 200;
I have enabled debugging and have a lot of logs. The relivant section
appears to be:
2010/03/26 17:20:45 [debug] 22172#0: *163 copy filter: "/?"
2010/03/26 17:20:45 [debug] 22172#0: *163 http postpone filter "/?"
00000000006C7408
2010/03/26 17:20:45 [debug] 22172#0: *163 write old buf t:1 f:0
00000000006C7138, pos 00000000006C7138, size: 279 file: 0, size: 0
2010/03/26 17:20:45 [debug] 22172#0: *163 write new buf t:0 f:1
00000000006C7870, pos 00000000006C79D6, size: 1300 file: 358, size: 1300
2010/03/26 17:20:45 [debug] 22172#0: *163 http write filter: l:0 f:0
s:1579
2010/03/26 17:20:45 [debug] 22172#0: *163 http write filter limit 0
2010/03/26 17:20:45 [debug] 22172#0: *163 writev: 279
2010/03/26 17:20:45 [debug] 22172#0: *163 sendfile: @358 1300
2010/03/26 17:20:45 [debug] 22172#0: *163 sendfile: 1300, @358 1300:1300
2010/03/26 17:20:45 [debug] 22172#0: *163 http write filter
0000000000000000
2010/03/26 17:20:45 [debug] 22172#0: *163 copy filter: 0 "/?"
2010/03/26 17:20:45 [debug] 22172#0: *163 pipe write downstream done
2010/03/26 17:20:45 [debug] 22172#0: *163 event timer: 13, old:
1269624105234, new: 1269624105236
2010/03/26 17:20:45 [debug] 22172#0: *163 http file cache update
2010/03/26 17:20:45 [debug] 22172#0: *163 http file cache rename:
"/var/www/tmp/0000000081" to
"/var/www/cache/8/ac/3577c9b1c200387b980a8810e0b67ac8"
2010/03/26 17:20:45 [crit] 22172#0: *163 chmod()
"/var/www/tmp/0000000081" failed (2: No such file or directory) while
reading upstream, client: 1.1.1.1, server: www.example.net,
request: "GET / HTTP/1.1", upstream: "http://1.2.3.4:80/", host:
"www.exmaple.net:80"
2010/03/26 17:20:45 [crit] 22172#0: *163 unlink()
"/var/www/tmp/0000000081" failed (2: No such file or directory) while
reading upstream, client: 1.1.1.1, server: www.example.net,
request: "GET / HTTP/1.1", upstream: "http://1.2.3.4:80/", host:
"www.exmaple.net:80"
2010/03/26 17:20:45 [debug] 22172#0: *163 http upstream exit:
0000000000000000
2010/03/26 17:20:45 [debug] 22172#0: *163 finalize http upstream
request: 0
2010/03/26 17:20:45 [debug] 22172#0: *163 finalize http proxy request
2010/03/26 17:20:45 [debug] 22172#0: *163 free rr peer 1 0
So it seems it can't chmod or ulink the file cause it's not there.
There's no indication of why this might be. Nginx quite happilly
creates the proxy tmp directory but doesn't appear to put anything in
it. Even though the debug suggests that it thinks that is has.
Does anyone have any idea what is going on?
I've only seen on similar occurance of this on the Russian list but this
was in Russian :-) Google translate suggested that they didn't really
bottom it out.
Mike.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://nginx.org/pipermail/nginx/attachments/20100327/cda2a2bb/attachment.pgp>
More information about the nginx
mailing list