Welcome! Log In Create A New Profile

Advanced

Nginx fastcgi_cahe + wordpress

January 09, 2011 05:20AM
Приветствую!

Столкнулся с проблемой не могу заставить кешировать 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]
Subject Author Posted

Nginx fastcgi_cahe + wordpress

uradvd85 January 09, 2011 05:20AM

Re: Nginx fastcgi_cahe + wordpress

uradvd85 January 09, 2011 07:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 196
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