404 的标准 Apache 错误文档的位置是什么?

use*_*472 4 apache httpd.conf

我正在为 apache 定制各种错误代码,我知道如何做到这一点。(通过添加新页面并在 /etc/httpd/conf/httpd.conf 中针对各种错误代码引用它们。

我的问题是 - apache 的标准错误消息从何而来?例如,如果我运行本地 apache 并尝试浏览不存在的 URL,则会出现以下错误。

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /not_found was not found on this server.</p>
<hr>
<address>Apache/2.2.15 (CentOS) Server at localhost Port 80</address>
</body></html>
Run Code Online (Sandbox Code Playgroud)

我的 httpd.conf 没有任何 ErrorDocument 覆盖。所以这是标准的 apache 错误。当我 grep 时,我没有找到任何包含这些文本的文件。

那么这是否意味着这是来自 apache 模块?

use*_*472 5

回答我自己的问题:

该错误来自“c”文件,而 apache 没有我最初认为的默认错误 html。httpd 源可以是http://httpd.apache.org/download.cgi

请参阅“src\main\http_protocol.c”文件,下面是使用给定消息引发 404 异常的代码。

case NOT_FOUND:
        ap_rvputs(r, "The requested URL ",
              ap_escape_html(r->pool, r->uri),
              " was not found on this server.<P>\n", NULL);
        break;
Run Code Online (Sandbox Code Playgroud)