Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


   


   


   















      :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Nginx fastcgi_cahe + wordpress


  • To: nginx-ru@xxxxxxxxx
  • Subject: Nginx fastcgi_cahe + wordpress
  • From: "uradvd85" <nginx-forum@xxxxxxxx>
  • Date: Sun, 09 Jan 2011 05:20:46 -0500
  • Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mickey.jlkhosting.com; s=x; h=Sender:From:Message-ID:Content-Transfer-Encoding:Content-Type:Subject:To:Date; bh=s0gKhqnwNYuDthk0ZPWxvRGLT4S5y6GiUGNwFmX/be0=; b=gyjUXh/1dLhXswRFSrjt5YlGGMwX+UfoUnQw4BwBsLwsHlItG0MUThdXEdx5eKiQDRKB/akiTdZpJwlY2DPanL/xQYZ6CCkUtaAEdM25/PaYUSmriVSxVCqu1sSkRnJa;

!

    
  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]
(My(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 mailing list
nginx-ru@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.