当我突然发现浏览器只需在地址中键入“ /”就可以访问我的根目录时,我在玩耍。我检查了httpd.conf,其中明确指出:
<Directory "/">
AllowOverride none
Require all denied
</Directory>
我正在使用Fedora 29,这是我的httpd.conf:
ServerRoot "/etc/httpd"
Listen 80
LimitRequestBody 5242880
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
<Directory "/">
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">
LimitRequestBody 5242880
AllowOverride None
Require all granted
</Directory>
<Directory "/var/www/html">
LimitRequestBody 5242880
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<Files ".ht*">
Require all denied
</Files>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
<Directory "/var/www/cgi-bin">
LimitRequestBody 5242880
AllowOverride None
Options +ExecCGI
Require all granted
SetHandler fcgid-script
</Directory>
<IfModule mime_module>
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8
<IfModule mime_magic_module>
MIMEMagicFile conf/magic
</IfModule>
EnableSendfile on
IncludeOptional conf.d/*.conf
LimitRequestBody 1024000
<Directory "/var/www/cgi-bin/data">
Order Deny,Allow
Deny From All
Allow From 127.0.0.1
</Directory>
为什么会这样?
答案 0 :(得分:0)
我的根目录没有被apache访问。这是文件uri参数。