Want more timely Centmin Mod News Updates?
Become a Member

Nginx Custom Error Pages

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

  1. arlon

    arlon Member

    95
    6
    8
    Feb 20, 2016
    Ratings:
    +12
    Local Time:
    4:31 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

    55,796
    12,271
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,857
    Local Time:
    7:31 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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

    95
    6
    8
    Feb 20, 2016
    Ratings:
    +12
    Local Time:
    4:31 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

    55,796
    12,271
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,857
    Local Time:
    7:31 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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

    95
    6
    8
    Feb 20, 2016
    Ratings:
    +12
    Local Time:
    4:31 PM
    1.13.6
    10.1
    yess,
     
  6. cloud9

    cloud9 Premium Member Premium Member

    435
    118
    43
    Oct 6, 2015
    England
    Ratings:
    +218
    Local Time:
    10:31 AM
    1.25.3
    10.6.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:
    11:31 AM
    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

    435
    118
    43
    Oct 6, 2015
    England
    Ratings:
    +218
    Local Time:
    10:31 AM
    1.25.3
    10.6.x
    Thanks, Yes it was included (from default install)

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