Apache 2.4「不需要主機」有效,但在 apache 錯誤日誌中給予重複的 AH01753

Apache 2.4「不需要主機」有效,但在 apache 錯誤日誌中給予重複的 AH01753

在我的託管提供者從 Apache 2.2 升級到 Apache 2.4 後,有些事情困擾著我。

我的 .htaccess 中有這些 Apache 2.2 規則

order allow,deny
    deny from domain.tld
    deny from 1.2.3.4
allow from all

這些規則在 Apache 2.4 中已達到 500 條,所以我研究了 Apache 2.4 手冊和網絡,最後得出了

<RequireAll>
Require all granted
    Require not host domain.tld
    Require not ip 1.2.3.4
</RequireAll>

我用自己的 IP 位址和網域對此進行了測試,這有效,Apache 給了 403。

<Thu Dec 06 20:16:51.641853 2018> <authz_host:error> <pid 1347506:tid 140612011235072> <client 86.90.6.41:42035> AH01753: access check of 'domain.tld' to /index.html failed, reason: unable to get the remote host name

那裡說什麼?另外,因為我的 htaccess 中有更多“不需要主機”規則,所以它會為 htaccess 中的每個條目重複此“AH017053”錯誤。它對訪問者請求的每個文件都這樣做,因此在index.html之後,它會對“index.css”等重複此錯誤。

我希望這個錯誤消失,但我無能為力。另外,我想知道,如果 Apache 在測試情況下仍然阻止我自己的 IP 位址和域名,那麼這個錯誤試圖說明什麼?

我讀了https://httpd.apache.org/docs/2.4/mod/mod_authz_host.html我不確定,當 Apache 抱怨“AH017053”時,我是否應該能夠在某個地方找到它?

答案1

我在這裡找到了答案https://httpd.apache.org/docs/2.4/mod/mod_authz_host.html

代替
Require not host domain.tld

它將停止嘗試雙重反向查找
Require not forward-dns domain.tld

原因解釋如下https://httpd.apache.org/docs/2.4/mod/core.html#hostnamelookups

相關內容