I have FreeBSD server with nginx as reverse proxy.
When I test it with ab util, I see some strange things, such as:
- Internal pages aren't cached.
- Main page is cached, but sometimes the non-cached version is returned.
I don't know where I've made a mistake. Please, help.
Here's part of the config:
worker_processes 4;
events {
worker_connections 4096;
}
http {
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 200;
proxy_buffer_size 4m;
proxy_buffers 24 1m;
proxy_busy_buffers_size 8m;
proxy_temp_file_write_size 4m;
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=all:512m;
keepalive_timeout 65;
reset_timedout_connection on;
aio sendfile;
directio 1M;
output_buffers 64 256k;
server {
listen < hidden >;
server_name < hidden >;
error_page 412 = @fallback;
proxy_cache_key "$host$request_uri";
proxy_cache_valid 404 5m;
proxy_cache_valid 500 501 502 503 504 1m;
proxy_cache_valid any 10m;
proxy_cache_use_stale http_502 http_503 http_504;
proxy_cache_bypass $cookie_logined;
proxy_no_cache $cookie_logined;
location / {
if ($cookie_logined) { return 412; }
proxy_cache all;
proxy_pass < hidden >;
proxy_redirect < hidden > /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
}