Override CiviCRM contact import timeout using PHP-fpm and Nginx
The import do generate a lot of requests indeed, the one you should care about is the POST one (that does the import). The others are mostly cosmetic to update the counter of how many contacts have been processed so far.

What matters for your rewrite isn't where the code is, but what's the url of that post. It depends of your install (check your log or the console on your browser), but it's likely not including the full path (vendor/civicrm/civicrm-core), eg something like:

location ^~ /civicrm/import/contact { ...


one trick I use to see if the location nginx rule is the correct one is to put an invalid fastcgi_pass, 50x errors are easier to see than waiting and trying to guess if the timeout worked or not ;)

This being said, if you have a lot of contacts to import, it's probably safer/easier to write a php script that you run from the CLI and that uses civicrm api to create the contacts (you don't have to deal with timeout, you have more memory, easier to do exactly the tests you want and create the data you need the way you want it.... and that's way easier to re-run if something breaks because some input is invalid)

X+