Welcome! Log In Create A New Profile

Advanced

Cannot set HTTP codes for fastcgi_cache_valid

Posted by coviex 
Cannot set HTTP codes for fastcgi_cache_valid
February 21, 2012 09:49AM
Hi,

"fastcgi_cache_valid" works for me only with "any". Setting 200, 301 etc. or omitting codes effectively turns caching off.
What's the problem?

Thanks

PS
it works with 1.1.14 on debian, but not with 1.0.10 on gentoo and latest on fedora.



Edited 1 time(s). Last edit at 02/21/2012 09:56AM by coviex.
Re: Cannot set HTTP codes for fastcgi_cache_valid
February 21, 2012 11:39AM
It turns out cache is not working. Cache directory grows but server doesn't serve cached pages back.
Installed 1.1.14 on gentoo. Nothing changed.
Here is nginx.conf
============
user nobody nobody;
worker_processes 1;
error_log /var/log/nginx/error_log debug;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main
'$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$gzip_ratio"';
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 20;
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=test_cache:32m inactive=5m;
include vhosts/*.conf;
}
============

vhost/project.conf
============
...
location ~ \.php$ {
error_page 406 = @fastcgi;
return 406;
}
location @fastcgi {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass_header Cookie;
fastcgi_ignore_headers Cache-Control Expires;
fastcgi_cache test_cache;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_cache_valid any 5m;
fastcgi_cache_min_uses 1;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index $index;
fastcgi_param SCRIPT_FILENAME /srv/www/project/web$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /srv/www/project/web;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
...
============

Any suggestions?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 272
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready