I know this will be a bit of a pain but the way I can think of doing it in that case is something along the lines of: location = /test { rewrite ^(.*)$ /test.txt; } location = / { limit_req zone=myzone burst=3 nodelay; index lala.html; } location ~ /somesite { rewrite ^(.*)$ /somesite.txt; } location = /somesite.txt { limit_req zone=myzone burst=3 nodelay; } location = /tesby LinuxJedi - Other discussion
The limit_req happens at a later phase of query processing than the rewrite. So when you do the /test and /somesite the rewrite happens before limit. The URL the rewrite is targeting is not exactly '/' so the middle location isn't getting hit by the rewrite either to limit there. I suspect what you want is: location = /test { rewrite ^(.*)$ /test.txt; } location / { limit_req zone=myzoby LinuxJedi - Other discussion
Is the PHP script that is triggered taking longer than 15 seconds to respond? If so this could trigger one of the retries in your upstream section. Alternatively the emergency restart of the php-fpm configuration may be triggered towards the end of processing a request which would cause nginx to retry the request. You may find that the php-fpm error logs give some clues. Finally I think theby LinuxJedi - Other discussion