How to make nginx to show page "Site down" when VirtualHost site opens for a minute or more (because of bad site code), and page "Apache down" when its ddos (server load average is >100) or Apache is down or something else?
Apache (2.2 FreeBSD) is running on 127.0.0.1 with a lot of VirtualHosts.
For now I have such nginx.conf:
server {
listen 80;
server_name localhost;
error_page 404 /404.html;
error_page 500 502 /apache_down.html;
error_page 503 504 /site_down.html;
location / {
proxy_pass http://127.0.0.1:88;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 5;
proxy_read_timeout 6;
proxy_send_timeout 6;
proxy_intercept_errors off;
}
location = /404.html {
root /usr/local/www/apache22/data;
}
location = /apache_down.html {
root /usr/local/www/apache22/data;
}
location = /site_down.html {
root /usr/local/www/apache22/data;
}
The main problem, that when load average is very high, nginx returns "Site down" instead of "Apache down". Tried to use "try_files" but no luck.
nginx
track the CPU load?