nginx how to get status of webservers on the backend?
There are a couple of modules you may want to check out:
- https://github.com/anomalizer/ngx_upstream_status (displays status as seen by the worker serving the status page)
- https://github.com/yaoweibin/nginx_upstream_check_module (proactively checks status of upstream servers)
- https://github.com/cep21/healthcheck_nginx_upstreams (similar to the previous one but only supports HTTP 1.0 for status checks)
- http://nginx.localdomain.pl/wiki/UpstreamFair (load balancer with built-in status page)
- ...
Unfortunately this is almost impossible out of the box. vanila nginx has not global state for upstream by design so this information is local for every worker process.
Take a look at this module seems may be useful for you http://wiki.nginx.org/NginxHttpHealthcheckModule