Nginx fastcgi_cahe + wordpress
uradvd85
nginx-forum на nginx.us
Вс Янв 9 13:20:46 MSK 2011
Приветствую!
Столкнулся с проблемой не могу
заставить кешировать nginx ответы
вот мой конфиг
[code]
fastcgi_cache_path /var/tmp/nginx/blog levels= keys_zone=blog:10m
max_size=512m inactive=20m;
server {
# client_header_buffer_size 4k;
# ssi on;
listen 80 default accept_filter=httpready;
charset utf-8;
server_name host.org;
root /usr/local/www/apache22/data/host;
index index.php;
set $do_not_cache "";
if ($http_cookie ~*
"comment_author_|wordpress_(?!test_cookie)|wp-postpass_" ) {
set $do_not_cache 1;
}
fastcgi_cache_bypass $do_not_cache;
fastcgi_no_cache $do_not_cache;
fastcgi_pass_header Cookie;
fastcgi_cache blog;
fastcgi_cache_valid 301 8h;
fastcgi_cache_valid 404 1h;
fastcgi_cache_valid 200 15m;
fastcgi_cache_key "$request_method|$host|$request_uri";
location / {
try_files $uri $uri/ @wordpress;
}
location ~
^/(wp-admin/.*\.php|wp-login\.php|wp-register\.php|(feed|comment/feed)(/.*)?)$
{
try_files $uri @wordpress;
set $do_not_cache 1;
fastcgi_cache_bypass 1;
fastcgi_no_cache 1;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/php-fpm.sock;
fastcgi_index index.php;
include /usr/local/etc/nginx/fastcgi_params;
}
location ~ \.php$ {
try_files $uri @wordpress;
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if ($do_not_cache != "1") {
add_header Vary Cookie;
}
}
location @wordpress {
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_NAME /index.php;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_index index.php;
fastcgi_pass unix:/var/php-fpm.sock;
if ($do_not_cache != "1") {
add_header Vary Cookie;
}
}
}
[/code]
вот единственный кешированный ответ
[code]
ЩЖ(MЪЪЪЪЪЪЪЪyС(MъГ⌡)─кontent
KEY:
GET|host.org|/wp-content/plugins/top-10/top-10-addcount.js.php?top_ten_id=1839
FX-Powered-By: PHP/5.3.3
content-type: application/x-javascript
[/code]
Posted at Nginx Forum: http://forum.nginx.org/read.php?21,164767,164767#msg-164767
Подробная информация о списке рассылки nginx-ru