代码之家  ›  专栏  ›  技术社区  ›  TheTanadu

如何获取默认的apache getting-started.html?

  •  0
  • TheTanadu  · 技术社区  · 7 年前

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

    我有标准 /var/www/html 目录,但我只是删除它,我做了虚拟主机,但我没有想过复制默认页面(即 index.html )但我需要它回来。在哪里可以找到它,或者如何向apache发送“请求”以在 /var/www/* 是吗?

    我在用centos7。

    1 回复  |  直到 7 年前
        1
  •  0
  •   larsks    7 年前

    您使用的是centos,所以可能是从 httpd 包裹。中没有内容 /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 进入虚拟主机 网站根目录 是的。