我有一个带有此缓存配置的nginx Web服务器:
proxy_cache_valid any 60m;
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my-cache:400m max_size=100m inactive=600m;
proxy_temp_path /var/cache/nginx/tmp;
我的位置缓存是:
location / {
proxy_pass http://127.0.0.1:8080;
# by vahid for proxy cache
proxy_cache my-cache;
proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Remote_addr $remote_addr;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 420;
client_max_body_size 100m;
client_body_buffer_size 128k;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
root /var/www/html;
}
在我的nginx访问日志中,我看到了这样的请求文件:
x.x.x.x - - [datetime] "GET /siY3Dh9_535.jpg HTTP/1.1" 200 31157 HIT 0.004
这个日志说请求被命中,nginx没有查找apache但是我在apache访问日志中得到了这个请求。我认为这是一个问题。
这是apache访问日志示例: 127.0.0.1 - - [16 / Dec / 2013:10:02:31 +0330]“GET /siY3Dh9_535.jpg HTTP / 1.0”200 -