Debian11默认配置Apache2.4访问/.htm/.html返回403而非404的原因求助
Debian11默认配置Apache2.4访问/.htm/.html返回403而非404的原因求助
大家好,我碰到一个挺奇怪的Apache问题,想请教下各位:
我在Debian 11上安装了apache2,全程没修改过任何配置文件,用的就是系统自带的默认配置。但测试的时候发现了一个异常情况:
- 当我访问
http://localhost/.htm或者http://localhost/.html这些不存在的文件时,返回的是403 Forbidden状态码,而不是我预期的404 - 但如果访问
http://localhost/.abc这类其他后缀的不存在文件,却能正常返回404 Not Found
有没有大佬知道这是为啥呀?难道是默认配置里有什么针对.htm/.html后缀的特殊规则吗?
下面是我的默认虚拟主机配置:
<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost>
备注:内容来源于stack exchange,提问作者byteunit
相关产品推荐
相关产品推荐

