C
C
Cyril2017-06-23 21:38:25
Nginx
Cyril, 2017-06-23 21:38:25

How to configure Nginx to do this?

Nginx acts as a proxy web server. It redirects all requests to the internal network web server. How can I make Nginx immediately indicate that the internal web server is unavailable if the user tries to type an address in the browser's address bar? Now I have to wait for Nginx to show a 502 error

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chupasaurus, 2017-06-23
@belyaevcyrill

For example, via the upstream module :

upstream intraserver {
  server internal-ip:port max_fails=2 fail_timeout=10;
  server 127.0.0.2:8880 backup;
}

server {
  listen 127.0.0.2:8880;
  return 502;
}
server {
...
proxy_pass http://intraserver;
...
}

max_fails - number of connection or response errors (determined before the proxy_pass function ) for the fail_timeout period , starting from which the upstream is considered to be down;
backup - a parameter indicating what should be transferred there, if all other upstreams are lying, in the config it gives 502 to everything.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question