error_page 404 = http://www.lynn.cn/404.html;
error_page 503 = http://www.lynn.cn/503.html;
error_page 504 = http://www.lynn.cn/504.html;
syntax: fastcgi_intercept_errors on|off
Note: You need to explicitly define the error_page handler for this for it to be useful. As Igor says, "nginx does not intercept an error if there is no custom handler for it it does not show its default pages. This allows to intercept some errors, while passing others as are."