Hi.
I use lighttpd 1.4.19 and mod_cache 1.6.0.
My settings:
server.port = 81
server.modules = (
"mod_status",
"mod_proxy",
"mod_accesslog",
"mod_cache"
)
cache.debug = "enable"
cache.bases = ("/tmp/.lighttpd")
cache.support-queries = "enable"
cache.refresh-pattern = (
"\.(?i)(js|css|xml)$" => "5", # update js/css/xml every 5 minutes
and on refresh requests
"\.(?i)(htm|html|shtml)$" => "5", # update html/htm/shtml every 5
minutes and on refresh requests
"\.(?i)(jpg|bmp|jpeg|gif|png)$" => "10", # 5 munutes
".(?i)php$" => "2" # update php request every 5 minutes
)
proxy.server = ( "/" =>
( (
"host" => "123.123.123.123",
"port" => 80
) )
)
proxy.worked-with-mod-cache = "enable"
I check the mod_cache work the following way:
# wget -S
http://aaa:81/ruska2.jpg
--21:43:49--
http://aaa:81/ruska2.jpg
=> `ruska2.jpg'
Resolving aaa... 123.123.123.123
Connecting to aaa|123.123.123.123|:81... connected.
HTTP request sent, awaiting response...
HTTP/1.0 200 OK
Connection: keep-alive
Date: Sun, 16 Nov 2008 18:43:49 GMT
Server: Apache/2.2.9 (Unix) PHP/5.2.6
Last-Modified: Tue, 28 Oct 2008 12:56:51 GMT
ETag: "2051e5b7-2ce96-45a4fc7fceac0"
Accept-Ranges: bytes
Content-Length: 183958
Cache-Control: max-age=399
Expires: Sun, 16 Nov 2008 18:50:28 GMT
Content-Type: image/jpeg
X-Cache: HIT
Length: 183,958 (180K) [image/jpeg]
100%[============================================================>]
183,958 --.--K/s
21:43:49 (9.85 MB/s) - `ruska2.jpg' saved [183958/183958]
In lighttpd log:
233.233.233.233 aaa:81 - [16/Nov/2008:21:43:49 +0300] "GET /ruska2.jpg
HTTP/1.0" 200 183958 "-" "Wget/1.10.2"
There is also a record in Apache log file:
123.123.123.123 - - [16/Nov/2008:21:43:49 +0300] "GET /ruska2.jpg HTTP/
1.0" 200 183958 "-" "Wget/1.10.2"
Why does lighttpd send request to backend and gets file from Apache
despite the fact that files are in cache
# ls -l /tmp/.lighttpd/aaa\:81/ruska2.jpg
-rw-r--r-- 1 www daemon 183958 Oct 28 15:56 /tmp/.lighttpd/aaa:81/
ruska2.jpg
?
(error log lighttpd is empty)