Custom 403 page not working(?) in combination with "deny all"

hshh hunreal at gmail.com
Fri Sep 5 19:21:53 MSD 2008


just add "allow all;" to your location.

location = /403.html {
           root   /usr/share/nginx/html;
           allow all;
}

On Wed, Sep 3, 2008 at 6:42 AM, Peter Vandenberk <pvdb at bragster.com> wrote:
> (apologies if this is a re-post, but the GMANE auto-authorizer
> seems to have gobbled my original post)
>
> Hi all,
>
> I am trying to configure nginx 0.6.32 to serve a customized
> 403.html error page, but it doesn't appear to be working...
> I am using "nginx -t" to check my config files, so I don't think
> it's a configuration issue.
>
> No matter how I try to shift things around in the config file,
> nginx never seems to serve my custom 403.html page, but
> instead always returns the built-in, hardcoded "403 Forbidden"
> page (the one with the HR, and nginx version footer).
>
> I have verified that the 403.html can be served by nginx (so I'm
> pretty sure it's not a path or permissions issue), and have also
> tried to find relevant postings on the net... the closest match I
> could find to my problem is:
>
> http://osdir.com/ml/web.nginx.english/2007-01/msg00046.html
>
> ... but I don't have an upstream backend in this particular nginx
> configuration, so I don't think the re-writing response from Igor
> applies to my problem.
>
> Any ideas/pointers that may be of help?  I have included all relevant
> information I can think of at the bottom of this email
>
> Many thanks in advance,
>
> Peter
>
> PS - I have also compiled my nginx instance with --with-debug
> and am using the debug_connection directive to try to understand
> what's going on, but I must admit the log output is so verbose that
> I'm struggling to get my head around it, even for a single HTTP
> request ... is there something specific I should be looking for?
> or would it help if I post the entire debug output?
>
> VERSION INFO
>
> pvdb at jupiler ~ $ /usr/local/nginx/sbin/nginx -V
> nginx version: nginx/0.6.32
> built by gcc 4.1.1 20070105 (Red Hat 4.1.1-51)
> configure arguments: --with-http_dav_module --with-debug
> pvdb at jupiler ~ $ _
>
> NGINX CONFIG (http section)
>
> http {
>
>    allow  192.168.1.0/24;
>    allow  127.0.0.1;
>    deny all;
>
>    ...
>
> }
>
> NGINX CONFIG (server section)
>
> server {
>
>        ...
>
>        error_page  403              /403.html;
>        location = /403.html {
>            root   /usr/share/nginx/html;
>        }
>
>        ...
> }
>
> FYI: I have tried various combinations/variants/locations
> for the above snippets, but nothing seems to actually
> serve my custom 403.html page
>
>
>
>
>





More information about the nginx mailing list