error_page可以配置在http、server、location塊;
1. 跳轉
error_page 404 http://www.baidu.com;
2. 重定向
我嘗試把頁面放到別的路徑下,但是error日志顯示,error.html只能放在nginx/html目錄下,查看官方文檔也沒有其他方法。
error_page 404 =200 /error.html;
3.@符號指定到location的url上
error_page 404 @another_url; location @another_url { root /home/wc/nginx.d; }