欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

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

程序员文章站 2023-09-09 20:50:00
在内网中 暂时需要一台 文件 服务器,所以准备安装一台 http服务器并开启目录访问权限。这次使用 apache 在 fedora 28 机器上: 因为 fedora 2...

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

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

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

进入如下文件夹:

[root@dhcp-65-15 conf.d]# pwd
/etc/httpd/conf.d
[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>

进行注释上述文件:

[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 文件配置如下所示:

<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 并 开启目录浏览模式,希望对大家有所帮助