How to Enable Custom Error Pages for Apps using Nginx and uWSGI

Here’s a quick tutorial on how to enable error pages on your application when using uWSGI and Nginx. Let’s assume you have your nice custom 500 error page created and want Nginx to use it. First, add the error page configuration to Nginx as follows:


error_page 500 /my_500.html
location = /my_500.html {
   root /some/path;

You may notice Nginx still serves its default 500 error page. To make your custom pages work, add the following statement:

uwsgi_intercept_errors on;

That’s all for now. Happy coding!