Custom Error Pages with Nginx
Posted on:
While revamping some of our VPS we use to host some client websites I found a strange issue with nginx web server causing the default boring error pages to display instead of the custom error pages we coded.
I'm not entirely sure why this would happen on some virtual hosts and not others as they all use mostly the same generic configuration.
Anyways, I did some googling and found someone stating on Stack Overflow if you have a "return 403;" in a server block and not in a location block, it will not use the custom error pages set.
Even though it worked on some virtual hosts, I went and placed all the return statements inside a location block and they began displaying the proper custom error page.