Match all requests

I have this location configuration:

    location /
    {
            index  maintenance.htm;
            error_page 404 = maintenance.htm;
            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?

Ilan B.
Chief Technology Officer

6300 NE 1st Ave., Suite 203
Ft. Lauderdale, FL 33334
(954) 771-0914

http://www.twitter.com/time4learning
http://www.facebook.com/Time4Learning

Time4Learning.com - Online interactive curriculum for home use, PreK-8th
Grade.
Time4Writing.com - Online writing tutorials for high, middle, and
elementary school students.
Time4Learning.net - A forum to chat with parents online about kids,
education, parenting and more.
spellingcity.com - Online vocabulary and spelling activities for
teachers,
parents and students.

2011/11/13 Ilan B. [email protected]

example, causes the file to be downloaded instead of going to the
“maintenance.htm” file. How can I capture all requests?

Maybe if you put like this before the other locations:

location ~ .*$
{
index maintenance.htm;
error_page 404 = maintenance.htm;
log_not_found off;
}

On Sunday 13 November 2011 19:57:53 Ilan B. 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

Igor,

Thanks, but the code you provided still causes the
domain.com/index.phpfile to be downloaded instead of the maintenance
page to show up?

On Sun, Nov 13, 2011 at 11:44 AM, Igor S. [email protected] wrote:

which I thought captures all requests, however, entering “/index.php” for


nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Ilan B.
Chief Technology Officer
Time4Learning.com

6300 NE 1st Ave., Suite 203
Ft. Lauderdale, FL 33334
(954) 771-0914

http://www.twitter.com/time4learning
http://www.facebook.com/Time4Learning

Time4Learning.com - Online interactive curriculum for home use, PreK-8th
Grade.
Time4Writing.com - Online writing tutorials for high, middle, and
elementary school students.
Time4Learning.net - A forum to chat with parents online about kids,
education, parenting and more.
spellingcity.com - Online vocabulary and spelling activities for
teachers,
parents and students.

On 13.11.2011 22:38, Ilan B. wrote:

Thanks, but the code you provided still causes the
domain.com/index.phpfile to be downloaded instead of the maintenance
page to show up?

Because you use location .php$ for php, I presume so you need add there
something like 'try_files /maintenance.htm $uri =404;

There = to the php’s location block.

You may need read http://wiki.nginx.org/NginxHttpCoreModule#location

– Piotr.

On Sun, Nov 13, 2011 at 10:57:53AM -0500, Ilan B. wrote:

example, causes the file to be downloaded instead of going to the
“maintenance.htm” file. How can I capture all requests?

location / {
try_files /maintenance.htm =404;
}


Igor S.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs