NGINX: Setting Different FastCGI Read Timeouts for Folders
- by Hart Jones
I have a PHP file in my /batch/ folder I run with an hourly CRON job. Unfortunately this process can often take a few minutes to complete so I have had to increase my fastcgi_read_timeout to 300 seconds for the entire server.
I was wondering if it would be possible to change the fastcgi_read_timeout directive for only files in my /batch/ folder and not the entire server. For example something like this...
location ~ \.php$ {
fastcgi_pass localhost:9000;
fastcgi_read_timeout 5;
location /batch/ {
fastcgi_read_timeout 300;
}
include /usr/local/nginx/conf/fastcgi_params;
}
So basically all PHP files on the server would have a 5 second timeout except PHP files in my /batch/ folder. Is this possible?