服务器之家:专注于VPS、云服务器配置技术及软件下载分享
分类导航

Linux|Centos|Ubuntu|系统进程|Fedora|注册表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

服务器之家 - 服务器系统 - Fedora - 详解fedora 开启 apache 并 开启目录浏览模式

详解fedora 开启 apache 并 开启目录浏览模式

2022-07-13 09:20xuyaowen Fedora

这篇文章主要介绍了fedora 开启 apache 并 开启目录浏览模式的相关资料,非常不错,具有一定的参考借鉴价值,需要的朋友可以参考下

在内网中 暂时需要一台 文件 服务器,所以准备安装一台 http服务器并开启目录访问权限。这次使用 apache 在 fedora 28 机器上:

因为 fedora 28 已经包含 httpd 软件,使用systemctl start httpd 就能进行启动。

启动时 默认开启 目录访问权限,但是首次访问网站根目录的时候,会显示test page.

进入如下文件夹:

?
1
2
[root@dhcp-65-15 conf.d]# pwd
/etc/httpd/conf.d
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@dhcp-65-15 conf.d]# cat welcome.conf
#
# this configuration file enables the default "welcome" page if there
# is no default index page present for the root url. to disable the
# welcome page, comment out all the lines below.
#
# note: if this file is removed, it will be restored on upgrades.
#
<locationmatch "^/+$">
  options -indexes
  errordocument 403 /.noindex.html
</locationmatch>
<directory /usr/share/httpd/noindex>
  allowoverride none
  require all granted
</directory>

进行注释上述文件:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@dhcp-65-15 conf.d]# cat welcome.conf
#
# this configuration file enables the default "welcome" page if there
# is no default index page present for the root url. to disable the
# welcome page, comment out all the lines below.
#
# note: if this file is removed, it will be restored on upgrades.
#
#<locationmatch "^/+$">
#  options -indexes
#  errordocument 403 /.noindex.html
#</locationmatch>
#<directory /usr/share/httpd/noindex>
#  allowoverride none
#  require all granted
#</directory>
#alias /.noindex.html /usr/share/httpd/noindex/index.html

httpd 文件配置如下所示:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<directory "/var/www/html">
  #
  # 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 followsymlinks
  #
  # 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
  #
  allowoverride none
  #
  # controls who can get stuff from this server.
  #
  require all granted
</directory>

options  indexes followsymlinks

这个配置表明为 开启目录权限

结束后,你会看到如下所示画面:

详解fedora 开启 apache 并 开启目录浏览模式

总结

以上所述是小编给大家介绍的fedora 开启 apache 并 开启目录浏览模式,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!

原文链接:https://www.cnblogs.com/xuyaowen/archive/2018/07/24/apache_index_dir.html

延伸 · 阅读

精彩推荐