Hi,
Running a WP site under nginx. There is a requirement to increase the script timeout value (max_execution_time) as an operation on the site is timing out. I'd rather not increase that value for all parts of the site, as it increases the risk of DDoS attacks, so what I'd like to do is only increase it for the wp-admin directory, where users will be logged in and can be held accountable.
Current PHP config stanza is:
location ~* \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
if (!-e $document_root$document_uri){return 404;}
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
add_header "Access-Control-Allow-Origin" $http_origin;
}
(sorry, can't work out how to format code)
So would the correct modification. be as follows?
location ~* \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
if (!-e $document_root$document_uri){return 404;}
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
location /wp-admin/ {
fastcgi_read_timeout 600;
fastcgi_param PHP_VALUE "max_execution_time=180;";
}
add_header "Access-Control-Allow-Origin" $http_origin;
}