Skip to content

HTML Templates for HTTP errors (404, 500, 503 and 504).

License

Notifications You must be signed in to change notification settings

Aladdin-97/HTML_Template_http_codes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

HTML Templates for HTTP status codes

HTML Template HTTP Codes is a HTML templates to decorate your HTTP web server responses/errors
Change default nginx/apache templates for a responsive and more attractive design

Screenshots

Screenshot

Usage

Just clone/download the git repository (The html files are included on error number folder, example "500/index.html" for 500 Internal Server Error)

NGINX Integration

NGINX supports custom error-pages using multiple error_page directives.

File: nginx.conf (/etc/nginx/)

Example - assumes HttpErrorPages are located into /usr/share/nginx/html/.

server {
    listen 8000;
    server_name fe;

    try_files $uri $uri/ =404;
    
    # add one directive for each http status code
    error_page 401 /ErrorPages/401/index.html;
    error_page 403 /ErrorPages/403/index.html;
    error_page 404 /ErrorPages/404/index.html;
    error_page 500 /ErrorPages/500/index.html;
    error_page 503 /ErrorPages/503/index.html;
    error_page 504 /ErrorPages/504/index.html;

    # custom location for static files
    location ~* \.(js|jpg|png|css)$ {
        root /usr/share/nginx/html/custom_sources/;
        expires 30d;
    }

    # test error pages    
    location /throw401 {
        return 401;
    }
    location /throw500 {
        return 500;
    }
    location /throw403 {
        return 403;
    }
    location /throw404 {
        return 404;
    }

    location /throw503 {
        return 503;
    }
    location /throw504 {
        return 504;
    }


    # redirect the virtual ErrorPages path the real path
    location /ErrorPages/ {
        alias /usr/share/nginx/html/;
        internal;
    }
}

Apache Httpd Integration

Apache Httpd 2.x supports custom error-pages using multiple ErrorDocument directives.

File: httpd.conf or .htaccess

Example - assumes HttpErrorPages are located into your document root /var/www/...docroot../ErrorPages.

ErrorDocument 404 /ErrorPages/404/index.html
ErrorDocument 500 /ErrorPages/500/index.html
ErrorDocument 503 /ErrorPages/503/index.html
ErrorDocument 504 /ErrorPages/504/index.html

License

You can check out the full license here

This project is licensed under the terms of the MIT license.

About

HTML Templates for HTTP errors (404, 500, 503 and 504).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 48.3%
  • CSS 35.6%
  • JavaScript 16.1%