0

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?

2
  • nginx.org/en/docs/http/ngx_http_stub_status_module.html provides a bit more information and statistics than what you need if you only want to check if the server is alive and responding. More minimal can be a specific health monitoring location /server-random-health that always returns a 200 status except when the server is down serverfault.com/a/491817/37681 Commented Jul 14 at 8:42
  • @HBruijn Yep. But the Nginx is located inside container so I need to reconfigure container image I don't want to do. So I was trying to know if there's default page that can return status code only. Am I right that any way I want to get HTTP status code I first need to configure any page, and there's no default way? Commented Jul 14 at 8:52

1 Answer 1

1

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"; } 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.