Problem for play my custom pages error 401

reaman nginx-forum at forum.nginx.org
Sat Mar 12 07:31:18 UTC 2016


I come to you because I am facing a problem with the customization of the
401 error page in fact I use Nginx and rutorrent, I proceeded as follows:

I create a folder named "error_pages" I placed in the /var/www/
then I created my pages 400.html 401.html 403.html 404.html 503.html
50x.html

I created the page “error_pages.conf” (/etc/nginx/conf.d/error_pages.conf)
and I placed the code below

error_page 400 /error_pages/400.html;
location = /400.html {
        root /var/www/;
}

error_page 401 /error_pages/401.html;
location = /401.html {
    root /var/www/;
    auth_basic off;
    allow all;
}

error_page 403 /error_pages/403.html;
location = /403.html {
        root /var/www/;
        allow all;
}

error_page 404 /error_pages/404.html;
location = /404.html {
        root /var/www/;
        auth_basic off;
        internal;
}

error_page 503 /error_pages/503.html;
error_page 500 501 502 504 /error_pages/50x.html;
location ^~ /error_pages {
        root /var/www/;
        internal;
}

Then in the file "rutorrent.conf" located in the "/etc/nginx/sites-enabled"
the following code:

server {
         listen 443 default_server ssl http2;
…..
include /etc/nginx/conf.d/error_pages.conf;
.….

I restart nginx services.

But obviously my custom error page is not displayed in place of the original
one and I do not see why.

Can you help me ?

Thank you

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,265260,265260#msg-265260



More information about the nginx mailing list