Custom 500 Error Pages
Contents |
custom error pages Browse by products and services DV and VPS Hosting Grid Shared Hosting DV Developer Hosting Legacy DV Hosting Applies to: Grid Difficulty: Medium Time: 20 Tools needed: FTP Applies to: All DV Difficulty: Medium Time: 20 Tools needed: custom 500 error page nginx FTP Overview This article explains how to set up custom error documents for your custom 500 error page example server. Instead of a plain 404 Not Found or 500 Internal Server Error page, you can show your visitors a customized
Rails Custom 500 Error Page
page that matches your site design. READ ME FIRST The publishing of this information does not imply support of this article. This article is provided solely as a courtesy to our customers. Please take a moment
Best 500 Error Pages
to review the Statement of SupportStatement of Support. Results You should make these pages simple to generate - plain HTML is best. 404 pages especially are needed frequently, and the server will spend a lot of resources if it has to process a complex custom page every time someone generates a 404 request. Your .htaccess file will override the server default error pages, directing Apache to use custom pages instead. Using good 500 error pages custom error pages NOTE: You MUST add a "/" at the beginning of the path to your custom error document. The "/" references the document root of your server (/home/00000/domains/example.com/html/httpdocs by default). The path to your error document should be from the document root, regardless of whether you upload your .htaccess file to the document root directory or to a subdirectory. That's it! Your change will take affect within minutes. You can test your error handling by trying to generate the error yourself. For example, to test a new 404 Not Found page, try visiting http://example.com/this_subfolder_does_not_exist/. Replace example.com with your own domain name. You should see your custom Not Found page. Common client and server errors NOTE: For more information about different types of Status Codes, please see this page at w3.org: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html Create your error pages. The documents can have any name. The example will use not_found.html. Upload your error pages to your server using FTP. These pages should go inside your html (/home/00000/domains/example.com/html/) directory or a subdirectory. The example will use the subdirectory errors/ (/home/00000/domains/example.com/html/errors/) for error documents. Upload your error pages to your server using FTP. These pages should go inside your httpdocs directory or a subdirectory. The example will use the subdirectory errors/ for error documents. C
In submit Tutorials Questions Projects Meetups Main Site logo-horizontal DigitalOcean Community Menu Tutorials Questions Projects Meetups Main Site Sign Up Log In submit View All Results By: Justin Ellingwood Subscribe Subscribed Share Contents Contents We hope
Funny 500 Error Pages
you find this tutorial helpful. In addition to guides like this one, we provide custom 404 error page simple cloud infrastructure for developers. Learn more → 9 How To Configure Nginx to Use Custom Error Pages on Ubuntu 14.04 Posted custom 401 error page Jun 5, 2015 78.4k views Nginx Ubuntu Introduction Nginx is a high performance web server capable of serving content with flexibility and power. When designing your web pages, it is often helpful to customize every piece of https://mediatemple.net/community/products/dv/204643020/creating-custom-error-pages content that your users will see. This includes error pages for when they request content that is not available. In this guide, we'll demonstrate how to configure Nginx to use custom error pages on Ubuntu 14.04. Prerequisites To get started on with this guide, you will need a non-root user with sudo privileges. You can set up a user of this type by following along with our initial set up guide for Ubuntu https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-to-use-custom-error-pages-on-ubuntu-14-04 14.04. You will also need to have Nginx installed on your system. Learn how to set this up by following this guide. When you have completed the above steps, continue with this guide. Creating Your Custom Error Pages We will create a few custom error pages for demonstration purposes, but your custom pages will obviously be different. We will put our custom error pages in the /usr/share/nginx/html directory where Ubuntu's Nginx sets its default document root. We'll make a page for 404 errors called custom_404.html and one for general 500-level errors called custom_50x.html. You can use the following lines if you are just testing. Otherwise, put your own content in these locations:
- echo "
Error 404: Not found :-(
" | sudo tee /usr/share/nginx/html/custom_404.html - echo "
I have no idea where that file is, sorry. Are you sure you typed in the correct URL?
" | sudo tee -a /usr/share/nginx/html/custom_404.html - echo "
Oops! Something went wrong...
" | sudo tee /usr/share/nginx/html/custom_50x.html - echo "
We seem to be having some technical difficulties. Hang tight.
" | sudo tee -a /usr/share/nginx/html/custom_50x.html We now have two custom error pages that we can serve when client requests result in different errors. Configuring Nginx to Use your Error Pages Now, we just need to tell Nginx that it shouldgeneric error responses in the event of 4xx or 5xx HTTP status codes, these responses are rather stark, uninformative, and can https://httpd.apache.org/docs/2.4/custom-error.html be intimidating to site users. You may wish to provide custom error responses which are either friendlier, or in some language other than English, or perhaps which are styled more in line with your site layout. Customized error responses can be defined for any HTTP status code designated as an error condition - that is, any 4xx or 5xx status. Additionally, a set error page of values are provided, so that the error document can be customized further based on the values of these variables, using Server Side Includes. Or, you can have error conditions handled by a cgi program, or other dynamic handler (PHP, mod_perl, etc) which makes use of these variables. Configuration Available Variables Customizing Error Responses Multi Language Custom Error Documents See alsoComments Configuration Custom error 500 error page documents are configured using the ErrorDocument directive, which may be used in global, virtualhost, or directory context. It may be used in .htaccess files if AllowOverride is set to FileInfo. ErrorDocument 500 "Sorry, our script crashed. Oh dear" ErrorDocument 500 /cgi-bin/crash-recover ErrorDocument 500 http://error.example.com/server_error.html ErrorDocument 404 /errors/not_found.html ErrorDocument 401 /subscription/how_to_subscribe.html The syntax of the ErrorDocument directive is: ErrorDocument <3-digit-code>
where the action will be treated as: A local URL to redirect to (if the action begins with a "/"). An external URL to redirect to (if the action is a valid URL). Text to be displayed (if none of the above). The text must be wrapped in quotes (") if it consists of more than one word. When redirecting to a local URL, additional environment variables are set so that the response can be further customized. They are not sent to external URLs. Available Variables Redirecting to another URL can be useful, but only if some information can be passed which can then be used to explain or log the error condition more clearly. To achieve this, when the error redirect is sent, additional environment variables wil