ChocoDeveloper
ChocoDeveloper

Reputation: 14588

How to test nginx errors?

I'm trying to trigger an nginx error to test my error pages. This is what I tried:

server {
    // ...
    root /path/to/site
    error_page 504 502 500 = /html/error/500.html; # absolute path: /path/to/site/html/error/500.html
    return 500;
}

But I keep getting the default nginx error. Testing the html is not enough, I wanna make sure that nginx will show the correct error pages.

Any ideas?

Upvotes: 5

Views: 7632

Answers (1)

VBart
VBart

Reputation: 15110

 server {
     root /path/to/site
     error_page 504 502 500 = /html/error/500.html;

     location /get_error {
         return 500;
     }
 }

See the docs: http://nginx.org/en/docs/http/ngx_http_rewrite_module.html

Upvotes: 17

Related Questions