Match all requests

Valentin V. Bartenev ne at vbart.ru
Sun Nov 13 16:32:46 UTC 2011


On Sunday 13 November 2011 19:57:53 Ilan Berkner wrote:
> I have this location configuration:
> 
>         location /
>         {

This:
>                 index  maintenance.htm;
only captures requests to directories (i.e., ends with a /). 

This:
>                 error_page 404 = maintenance.htm;
only captures 404 responses.

>                 log_not_found off;
>         }
> 
> which I thought captures all requests, however, entering "/index.php" for
> example, causes the file to be downloaded instead of going to the
> "maintenance.htm" file.  How can I capture all requests?

Probably, you want something like this:

 error_page 404 = /maintenance.htm;

 location / {
   return 404;
 }

 location = /maintenance.htm {}

wbr, Valentin V. Bartenev



More information about the nginx mailing list