如何测试nginx错误?

Cho*_*per 4 nginx

我正在尝试触发nginx错误来测试我的错误页面.这是我试过的:

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;
}
Run Code Online (Sandbox Code Playgroud)

但我一直得到默认的nginx错误.测试html是不够的,我想确保nginx会显示正确的错误页面.

有任何想法吗?

VBa*_*art 14

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

     location /get_error {
         return 500;
     }
 }
Run Code Online (Sandbox Code Playgroud)

请参阅文档:http://nginx.org/en/docs/http/ngx_http_rewrite_module.html