0x00
这个小技巧还是非常实用的,我找了好些帖子实际上都是说的是 Apache 2.2,所以一直没成功,甚至有些怀疑自己了,这么简单的东西就是不起作用。最后发现的问题所在,下面记录下来。
yum install httpd
vim /etc/httpd/conf/httpd.conf
修改内容有:
DocumentRoot "/download"
# 要共享的目录
<Directory "/download">
# 目录的设置访问设置就两条
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
在这个例子中,所有的请求是允许的。我是走了好些弯路,有好些配置都是 Apache 2.2 中的,所以要改成 Apache 2.4 的才行。
2.2 配置:
Order allow,deny
Allow from all
2.4 配置:
Require all granted
最后重启 httpd:
systemctl restart httpd
再去登录 127.0.0.1
或 IP 地址,就能看到文件列表了。