Aqui minha pergunta foi respondida stackoverflow.com/a/35291314/1517230 por usuários de stackoverflow inteligentes:)
location ~ ^/api {
root /var/www/project/web/app.php;
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/?.*)$;
include fastcgi_params;
# Don't cache anything by default
set $no_cache 1;
# Cache GET requests
if ($request_method = GET)
{
set $no_cache 0;
}
fastcgi_cache_bypass $no_cache;
fastcgi_no_cache $no_cache;
fastcgi_cache fcgi;
fastcgi_cache_valid 200 5m;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
ou
map $request_method $api_cache_bypass {
default 1;
GET 0;
}
location ~ ^/api {
root /var/www/project/web/app.php;
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/?.*)$;
include fastcgi_params;
fastcgi_cache_bypass $api_cache_bypass;
fastcgi_no_cache $api_cache_bypass;
fastcgi_cache fcgi;
fastcgi_cache_valid 200 5m;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}