Nginx 隐藏 400 Bad Request 错误页面
解决方案
1在 `nginx.conf` 的 `server` 块中添加自定义错误页面:
server {
listen 80;
server_name localhost;
# 自定义 400 错误页面
error_page 400 /custom_400.html;
location = /custom_400.html {
internal;
root /path/to/your/error/pages;
}
}
2. 创建自定义错误页面文件
创建 custom_400.html 文件,内容可以是简单的提示信息:
<!DOCTYPE html>
<html>
<head>
<title>Bad Request</title>
</head>
<body>
<h1>请求错误</h1>
<p>您的请求存在问题,请检查后重试。</p>
</body>
</html>
欢迎来撩 : 汇总all
