"error_page"& "return" bug?
Nginx User
nginx at nginxuser.net
Sun Feb 19 16:37:02 UTC 2012
On 19 February 2012 18:54, Edho Arief <edho at myconan.net> wrote:
> Nevermind, I just got this awesome idea: if ($uri !~ ^/error_page/) {
> return 503; }
>
> (seems to be working on my simple test)
>
> On Sun, Feb 19, 2012 at 10:23 PM, Edho Arief <edho at myconan.net> wrote:
>> ...so, the method above is better than using location / { } block? I'm
>> confused now.
>>
>>
>> #############
>> server {
>> error_page 503 /error_docs/custom503.html;
>> location / {
>> return 503;
>> ...normal configs...
>> }
>> location /error_docs/ {
>> internal;
>> alias /server/path/to/error_docs/folder;
>> }
>> }
>> #############
Your method will work if you only a few location blocks active to
which you can easily add the return directive.
The one I suggested works in my case where I have several location blocks.
I have just put the relevant bits into a file and can include it when
I need to take the domain down.
It also allows for the inclusion of images, css. js and similar resources.
With these things, there is no single answer.
More information about the nginx
mailing list