L
L
levchick2014-11-12 17:36:36
Nginx
levchick, 2014-11-12 17:36:36

How to set up nginx so that when a certain number of requests are exceeded, it sends a request not to php-fpm, but to another server?

Good day.
Please tell me where to dig and what modules and configs to look for nginx in order to solve the following problem:
There is an nginx + php-fpm server. Requests come to it to display the site lying on it. It is necessary, when a certain number of requests are exceeded, not to process them, but to transfer them to another server. Moreover, this server has traffic filtering (protection against ddos), and it will return good requests back to the first server, which should already process them correctly.
I didn’t communicate with nginx before and I couldn’t google the solutions right away, I will be grateful for the tip. Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-11-12
Protko @Fesor

nginx.org/en/docs/http/ngx_http_upstream_module.html

D
Dan Ivanov, 2014-11-15
@ptchol

If it’s requests, then you should look at ngx_http_limit_req_module
. More specifically, when the limit is reached, throw out some kind of error, which is determined by the limit_req_status parameter, and then simply redefine error_page for it to some named location, in which you make fastcgi_pass to another upstream.
In theory, it should work :) Try it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question