我看到很多“客戶端被伺服器設定拒絕「我的一台伺服器上的日誌中出現錯誤,例如,
[Sun Mar 11 14:47:27.600091 2018] [:error] [pid 15375] [client 146.52.126.142:55685] script '/home/example/www/wp-login.php' not found or unable to stat
[Sun Mar 11 14:49:05.022447 2018] [authz_core:error] [pid 13727] [client 137.226.113.26:55086] AH01630: client denied by server configuration: /home/example/www/
[Sun Mar 11 14:58:22.853323 2018] [authz_core:error] [pid 14437] [client 163.172.226.46:58423] AH01630: client denied by server configuration: /home/example/www/downloader
[Sun Mar 11 14:58:59.747029 2018] [authz_core:error] [pid 13770] [client 163.172.226.46:50464] AH01630: client denied by server configuration: /home/example/www/downloader
[Sun Mar 11 14:58:59.812363 2018] [authz_core:error] [pid 16432] [client 163.172.226.46:56776] AH01630: client denied by server configuration: /home/example/www/downloader
[Sun Mar 11 14:59:00.599941 2018] [authz_core:error] [pid 15228] [client 207.46.13.65:11653] AH01630: client denied by server configuration: /home/example/www/
同時,在訪問日誌中,我看到其他客戶端顯然在同一時間有效地得到了服務,沒有出現任何問題(回應200
代碼與403
代碼):
146.52.126.142 - - [11/Mar/2018:14:47:27 -0400] "GET /wp-login.php HTTP/1.1" 404 4062 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"
146.52.126.142 - - [11/Mar/2018:14:47:27 -0400] "GET / HTTP/1.1" 200 27838 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1"
137.226.113.26 - - [11/Mar/2018:14:49:05 -0400] "GET / HTTP/1.1" 403 209 "-" "Mozilla/5.0 zgrab/0.x (compatible; Researchscan/t13rl; +http://researchscan.comsys.rwth-aachen.de)"
163.172.226.46 - - [11/Mar/2018:14:58:22 -0400] "GET /downloader/ HTTP/1.1" 403 220 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0"
163.172.226.46 - - [11/Mar/2018:14:58:59 -0400] "GET /downloader/ HTTP/1.1" 403 220 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0"
163.172.226.46 - - [11/Mar/2018:14:58:59 -0400] "GET /downloader/ HTTP/1.1" 403 220 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0"
207.46.13.65 - - [11/Mar/2018:14:59:00 -0400] "GET / HTTP/1.1" 403 209 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"
(我真正關心的是,例如,bingbot.htm以及屬於 Google 的 IP 位址 - 如果搜尋引擎很難從我的網站取得頁面,我有一個大的問題。
我不知道為什麼會發生「客戶端拒絕」錯誤,因為我造訪我的網站從來沒有遇到任何問題:我無法重現該故障。
我嘗試<Location>
按照接受的答案中的建議添加指令authz_core 不斷拒絕訪問,但是(正如我預期的那樣)它沒有任何區別:伺服器配置是正確的,據我所知。
這是伺服器的配置:
# redirect all HTTP (port 80) requests to the HTTPS server
<VirtualHost *:80>
ServerName secure.example.com
Redirect permanent / https://secure.example.com/
</VirtualHost>
<VirtualHost *:80>
ServerName www.example.com
Redirect permanent / https://www.example.com/
</VirtualHost>
<VirtualHost *:80>
ServerName example.com
ServerAlias *.example.com
Redirect permanent / https://example.com/
</VirtualHost>
# HTTPS server configuration
<VirtualHost *:443>
ServerName secure.example.com
ServerAlias example.com www.example.com
ServerAdmin [email protected]
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile /path/to/example.com/fullchain.pem
SSLCertificateKeyFile /path/to/live/example.com/privkey.pem
DocumentRoot "/home/example/www"
<Directory "/home/example/www">
Options All MultiViews
AllowOverride All
Require all granted
</Directory>
<Location "/">
Require all granted
</Location>
LogLevel debug
ErrorDocument 404 /cgibin/badurl.php
ErrorLog "|/usr/local/sbin/rotatelogs /home/example/logs/error_log 86400"
CustomLog "|/usr/local/sbin/rotatelogs /home/example/logs/access_log 86400" combined
CustomLog "|/usr/local/sbin/rotatelogs /home/example/logs/ssl_request_log 86400" ssl_request
BrowserMatch "MSIE [2-5]" ssl-unclean-shutdown nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [6-9]" ssl-unclean-shutdown
<Files ~ "\.(cgi|shtml|phtml|php4|php|pl)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/home/example/cgibin">
SSLOptions +StdEnvVars
</Directory>
<IfModule mod_alias.c>
ScriptAlias /cgibin/ "/home/example/cgibin/"
<Directory "/home/example/cgibin">
AllowOverride None
Options FollowSymlinks
Require all granted
</Directory>
</IfModule>
</VirtualHost>
.htaccess
目錄中沒有文件,所以我不知道是什麼導致了這個問題,即使LogLevel
設定為debug
,我在錯誤日誌中得到的只是「客戶端被拒絕」訊息。
這些錯誤是否是惡意客戶端嘗試使用我的伺服器作為代理?如果是這樣,我怎麼能讓他們停止敲打它? ……或者還有其他問題嗎?
有什麼方法可以將更多偵錯資訊寫入日誌,以便我可以了解失敗發生的原因?
Server version: Apache/2.4.29 (FreeBSD)
Server built: unknown
FreeBSD Dreamer 11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: Tue Nov 14 06:12:40 UTC 2017 [email protected]:/usr/obj/usr/src/sys/GENERIC amd64