1
lhbc 2016-06-28 10:46:14 +08:00 1
|
3
lhbc 2016-06-28 11:03:18 +08:00 2
可以用以下指令
error_page 404 http://example.com/forbidden.html; error_page 404 =301 http://example.com/notfound.html; =后面可以用 301, 302, 303, 307 这样做,会产生一次跳转,非常不友好 最优雅的做法是这样 location / { error_page 404 = @fallback; } location @fallback { proxy_pass http://backend; } 或者 error_page 404 /404.html; location /404.html { internal; } 参考: http://nginx.org/en/docs/http/ngx_http_core_module.html#error_page |