Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test nginx errors?

Tags:

nginx

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?

like image 458
ChocoDeveloper Avatar asked Dec 09 '22 19:12

ChocoDeveloper


1 Answers

 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

like image 67
VBart Avatar answered Dec 11 '22 09:12

VBart