読者です 読者をやめる 読者になる 読者になる

nginx + php-fpm fastcgi で キャッシュする

fastcgi_cache_path /var/cache/nginx/fscgi levels=1:2 keys_zone=fscgi_dayo:10m inactive=10m;

server {
    listen       80;
    server_name  test.com;

    access_log  /var/log/nginx/access_dayo.log ltsv;
    error_log   /var/log/nginx/error_dayo.log warn;

    root   /var/www/html/dayo/current/public;

    location / {
        index  index.html;
    }

    location ~* \.php$ {

        try_files $uri =404;

        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;

        fastcgi_cache         fscgi_dayo;
        fastcgi_cache_key     "$scheme://$host$request_uri";
        fastcgi_cache_valid   200 30m;

        include        fastcgi_params;
    }
}