Learn about Centmin Mod LEMP Stack today
Register Now

Nginx Custom Error Pages

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by xaitmi, Feb 7, 2015.

  1. arlon

    arlon Member

    92
    6
    8
    Feb 20, 2016
    Ratings:
    +12
    Local Time:
    6:35 PM
    1.13.6
    10.1
    Hello, i have weird error, when i enable custome error page by uncomment include /usr/local/nginx/conf/errorpage.conf;


    all error page go to 404.html error, then i try access mydomain.com/500.html it goes to 404.html too, this is my default erorr page

    error_page 403 /403.html;
    error_page 404 /404.html;
    error_page 500 /500.html;
    error_page 502 /502.html;
    error_page 503 /503.html;
    error_page 504 /504.html;

    location = /403.html {
    access_log off;
    internal;
    }

    location = /404.html {
    access_log off;
    internal;
    }

    location = /500.html {
    allow all;
    access_log off;
    internal;
    }

    location = /503.html {
    allow all;
    access_log off;
    internal;
    }

    location = /504.html {
    allow all;
    access_log off;
    internal;
    }

    location = /50x.html {
    allow all;
    access_log off;
    internal;
    }
     
  2. eva2000

    eva2000 Administrator Staff Member

    47,551
    10,789
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,774
    Local Time:
    9:35 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    do the actual error html files like 500.html exist in /home/nginx/domains/domain.com/public web root ?

    Also for code posting, might want to use CODE tags for code How to use forum BBCODE code tags :)
     
  3. arlon

    arlon Member

    92
    6
    8
    Feb 20, 2016
    Ratings:
    +12
    Local Time:
    6:35 PM
    1.13.6
    10.1
    yess of course, it fixed when i remove :

    Code:
    location = /403.html {
    access_log off;
    internal;
    }
    
    location = /404.html {
    access_log off;
    internal;
    }
    
    location = /500.html {
    allow all;
    access_log off;
    internal;
    }
    
    location = /503.html {
    allow all;
    access_log off;
    internal;
    }
    
    location = /504.html {
    allow all;
    access_log off;
    internal;
    }
    
    location = /50x.html {
    allow all;
    access_log off;
    internal;
    }
     
  4. eva2000

    eva2000 Administrator Staff Member

    47,551
    10,789
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,774
    Local Time:
    9:35 PM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    so you only left
    Code:
    error_page 403 /403.html;
    error_page 404 /404.html;
    error_page 500 /500.html;
    error_page 502 /502.html;
    error_page 503 /503.html;
    error_page 504 /504.html;
     
  5. arlon

    arlon Member

    92
    6
    8
    Feb 20, 2016
    Ratings:
    +12
    Local Time:
    6:35 PM
    1.13.6
    10.1
    yess,
     
  6. cloud9

    cloud9 Premium Member Premium Member

    147
    55
    28
    Oct 6, 2015
    England
    Ratings:
    +78
    Local Time:
    11:35 AM
    1.19.x
    10.4.x
    Just found out that IPB4.1.13 serves me a 503 error when the board is offline in FF and chrome (not safari)

    Any way to disable this and have the IPB banner board down for maintenance
     
  7. Ahmad

    Ahmad Active Member

    209
    80
    28
    Apr 13, 2015
    Ratings:
    +150
    Local Time:
    12:35 PM
    1.9.9
    10.1.10
    When IPS is offline the HTTP Code returned is 503 (Service unavailable) which is correct.
    I assume that you may have included the /usr/local/nginx/conf/errorpage.conf file in youe vhost file.
    If so, try commenting it out, or comment the 503 part in errorpage.conf out.
     
  8. cloud9

    cloud9 Premium Member Premium Member

    147
    55
    28
    Oct 6, 2015
    England
    Ratings:
    +78
    Local Time:
    11:35 AM
    1.19.x
    10.4.x
    Thanks, Yes it was included (from default install)

    Just commented it out - sorted - IPB4 now shows the maintenance page