How to configure nginx to shut down access to the site and sent to the plug at the time?

There is a big config nginx with different location and proxy_pass in httpd. It is necessary to temporarily cut off httpd to forward all requests to a static page(a stub) to another directory. What and where to write the config for this?
March 19th 20 at 08:54
2 answers
March 19th 20 at 08:56
An example of the output plugs when the unavailability of the backend:
error_page 502 503 504 /maintenance.htm;
location ~ /maintenance\.(css|htm|jpg) {
 root /usr/share/nginx;

This saves the source address of the request. Ease in the fact that these parameters can be put in a separate file and connect as needed using include for any set of sites. Additionally, you can organize an automatic reload page, for example adding in the file maintenance.htm line:
<meta http-equiv="refresh" content="30" />
March 19th 20 at 08:58
location / {
 return 302;

before all locations s

Find more questions by tags Nginx