【问题标题】:How to obtain default Apache getting-started.html?如何获取默认的 Apache getting-started.html?
【发布时间】:2018-06-23 18:39:47
【问题描述】:

我的问题很简单,但对我来说很难解决。

我有标准的/var/www/html 目录,但我只是删除它并创建了虚拟主机,但我没有考虑复制默认页面(即index.html),但我需要它回来。在哪里可以找到它或如何向 Apache 发送“请求”以在 /var/www/* 的文件夹中生成它?

我正在使用 CentOS7。

【问题讨论】:

  • 看看 Apache 源代码,它可能就在里面。或者,如果这是一个开发服务器,您可以卸载 Apache 并重新安装它,但请注意不要删除您自己的任何工作。

标签: apache centos


【解决方案1】:

您使用的是 CentOS,所以大概您正在运行来自 httpd 软件包的 Apache。 /var/www/html中没有内容:

[root@a02004d67c2b /]# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core) 
[root@a02004d67c2b /]# find /var/www/html/
/var/www/html/

默认欢迎页面由/etc/httpd/conf.d/welcome.conf提供,如下所示:

<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
Alias /noindex/css/bootstrap.min.css /usr/share/httpd/noindex/css/bootstrap.min.css
Alias /noindex/css/open-sans.css /usr/share/httpd/noindex/css/open-sans.css
Alias /images/apache_pb.gif /usr/share/httpd/noindex/images/apache_pb.gif
Alias /images/poweredby.png /usr/share/httpd/noindex/images/poweredby.png

这意味着如果您的文件中没有 index.html DocumentRoot(即/var/www/html),Apache 将返回一个状态 代码 403 和来自/usr/share/httpd/noindex/index.html 的内容。

您可以为您的虚拟主机复制相同的配置,或者您可以将/usr/share/httpd/noindex 的内容复制到您的虚拟主机DocumentRoot

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-31
    • 2012-03-16
    • 1970-01-01
    • 2013-04-28
    • 2017-04-13
    • 2020-08-29
    • 2018-03-14
    • 1970-01-01
    相关资源
    最近更新 更多