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
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 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 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
You can check out the full license here
This project is licensed under the terms of the MIT license.