1

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.

2
  • 1.) "[...] when VirtualHost site opens for a minute or more [...]": Please elaborate. 2.) How should nginx track the CPU load?
    – gxx
    Jul 8, 2016 at 13:08
  • @gf_ 1.) I have shared hosting server. Some users have sites, that opens for a long time (usually because bad mysql requests). Just wanted to make information pages with informations thats hosting server is running but there is some problems with your site. 2.) Thought something like: if site opens too long, using Apache show "Site down" page. Also, If "Site down" page opens too long, using Nginx show "Apache down". Is it possible?
    – shellshock
    Jul 8, 2016 at 14:05

0

You must log in to answer this question.

Browse other questions tagged .