Welcome! Log In Create A New Profile

Advanced

Re: Display configuration at runtime?

Francis Daly
April 16, 2012 07:08PM
On Mon, Apr 16, 2012 at 06:02:45PM -0400, michael_teter wrote:

Hi there,

> My error log shows nothing, but my
> access log does show the visit.

The error log doesn't seem immediately useful in this case; but with
the debug log you can work out what is happening.

The short answer is "internal redirect", or "subrequest".

> Here's the relevant part of my config:

> error_page 503 /maintenance.html;
> if (-f $document_root/../tmp/stop.txt) {
> set $maintenance 1;
> }
>
> if ($maintenance) {
> return 503;
> }

For any request, if the file exists then return 503, which does an
internal redirect to /maintenance.html. This subrequest goes through the
same process, and since the file still exists, you would end up in a loop.

With the following config, you can break out of the loop:

error_page 503 /maintenance.html;
if ($uri = "/maintenance.html") {
break;
}
if (-f $document_root/../tmp/stop.txt) {
return 503;
}

Although I confess I don't know if there is a "best" way to implement
a 503 response to all requests in nginx based on the existence of a
flag file.

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Display configuration at runtime?

michael_teter April 16, 2012 05:15PM

Re: Display configuration at runtime?

Jim Ohlstein April 16, 2012 05:40PM

Re: Display configuration at runtime?

michael_teter April 16, 2012 06:02PM

Re: Display configuration at runtime?

michael_teter April 16, 2012 06:05PM

Re: Display configuration at runtime?

Jim Ohlstein April 16, 2012 06:26PM

Re: Display configuration at runtime?

Francis Daly April 16, 2012 07:08PM

Re: Display configuration at runtime?

Valentin V. Bartenev April 16, 2012 06:20PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 310
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready