I need to monitor Nginx via HTTP response status code (200). Does Nginx have default status code pages either I need to configure stab_status page?
1 Answer
Nginx has a modular architecture. Its behavior is entirely defined by the configuration, which may not involve the HTTP module (ngx_http_core_module) at all if the http { ... } block is not present. For example, you can have a configuration that uses only the ngx_stream_core_module (configured via the stream { ... } block), or one where Nginx operates exclusively as a video streaming server using the nginx-rtmp-module (configured via the rtmp { ... } block). So, what you're asking about simply cannot exist within Nginx's architecture.
The simplest health check page may be configured as follows:
location = /health { default_type text/plain; return 200 "I'm alive"; }
location /server-random-healththat always returns a 200 status except when the server is down serverfault.com/a/491817/37681