【发布时间】:2011-08-01 19:24:53
【问题描述】:
我学会了如何让 NGINX 返回503 客户错误页面,
但我不知道如何执行以下操作:
示例配置文件:
location / {
root www;
index index.php;
try_files /503.html =503;
}
error_page 503 /503.html;
location = /503.html {
root www;
}
如您所见,根据上面的代码,如果在我的根目录中找到一个名为503.html 的页面,该站点会将这个页面返回给用户。
但是似乎虽然上面的代码在有人简单地访问我的网站时有效,但输入
它不会捕获以下请求:
使用我的代码,用户仍然可以看到个人资料页面或除index.php之外的任何其他页面。
问题:
当503.html 出现在我的根文件夹中时,如何捕获对我站点中所有页面的请求并将它们转发到503.html?
【问题讨论】:
标签: nginx redirect nginx-config http-status-code-503