Good day.

Tell me, please, where to dig and what modules and configs to watch for nginx to solve the following problem:

There is a nginx + php-fpm server.It receives requests to display the site lying on it.It is necessary that if a certain number of requests are exceeded, do not process them, but transfer them to another server.Moreover, this server is filtering traffic(protection from ddos), and it will return good requests back to the first server, which should correctly process them.
I haven’t communicated with nginx before and failed to google it right away, I will be grateful for the tip.Thank you!

2 Answers 2

nginx.org/en/docs/http/ngx_http_upstream_module.html
  • Thank you, I read this section of the docks, I don’t understand how to organize a rule that if the number of requests to the first server is exceeded, the requests went to the second, and all requests from the second to the first server should always be processed on the first. – Monty80 Nov 13 '14 at 13:24
If it’s just queries, you should look at ngx_http_limit_req_module
More specifically, when you reach the limit, you throw out any error, which is defined by the limit_req_status parameter, and then simply override for it error_page to some named location in which you make fastcgi_pass already to another upstream.
The idea should work :) Try it.