fastcgi_cache_path /tmp/nginx-cache levels=1:2 keys_zone=XF:100m inactive=30m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_use_stale error timeout invalid_header http_500;
    set $skip_cache 0;
    # POST requests 
    if ($request_method = POST) {
        set $skip_cache 1;
    }  
    # Don't cache uris containing the following segments
    if ($request_uri ~* "cron.php|admin.php") {
        set $skip_cache 1;
    }  
    # Don't use the cache for logged in users 
    if ($http_cookie ~* "xf_skipPageCache") {
        set $skip_cache 1;
    }
location ~ .php$ {
        try_files $uri /index.php; 
        include fastcgi_params;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_cache_bypass $skip_cache;
           fastcgi_no_cache $skip_cache;
        fastcgi_cache XF;
        fastcgi_cache_valid  30m;
    }