Apache 2.4上的mod_autoindex

问题描述:

我正在尝试使用mod_autoindex和FancyIndexing设置一个站点,该站点将我的自定义标题放在目录列表的上方。我遇到的问题是,我的系统表现得好像我的HEADER.html不存在,无论我是否告诉它使用当前目录中的一个还是像/repos/HEADER.html这样的固定位置。Apache 2.4上的mod_autoindex

配置文件autoindex.conf有

ReadmeName README.html 
HeaderName HEADER.html 

,我也尝试添加这些行到我的虚拟主机的/回购目录部分,但注意到改变。这个设置在CentOS 6.6上,使用CentOS scl repo的Apache 2.4.6和PHP 5.4.16。以下是我的vhost配置的副本供参考。任何帮助或建议将不胜感激。

<VirtualHost 10.0.2.15:8080> 
    ServerName reflector.localdomain 

    ## Vhost docroot 
    DocumentRoot "/opt/rh/httpd24/root/var/www/html" 
    ## Alias declarations for resources outside the DocumentRoot 
    Alias /icons "/opt/rh/httpd24/root/usr/share/httpd/icons" 

    ## Directories, there should at least be a declaration for /opt/rh/httpd24/root/var/www/html 

    <Directory "/opt/rh/httpd24/root/var/www/html"> 
    Options FollowSymLinks MultiViews 
    AllowOverride None 
    Require all granted 
    </Directory> 

    <Directory "/opt/rh/httpd24/root/var/www/html/repos"> 
    Options Indexes FollowSymLinks MultiViews 
    IndexOptions FancyIndexing FoldersFirst IgnoreCase SuppressDescription VersionSort XHTML 
    AllowOverride None 
    Require all granted 
    DirectoryIndex disabled 
    </Directory> 

    ## Logging 
    ErrorLog "/var/log/httpd24/MainSite_error.log" 
    ServerSignature Off 
    CustomLog "/var/log/httpd24/MainSite_access.log" combined 

    ## Custom fragment 
    ProxyPassMatch "^/(.*\.php(/.*)?)$" "fcgi://127.0.0.1:9000/opt/rh/httpd24/root/var/www/html/$1" 
</VirtualHost> 
+0

它在配置中提到了Puppet,你是​​使用Puppet来配置apache配置还是手动执行? –

+0

@PeterSouter我的最终目标是用puppetlabs-apache模块来完成,到目前为止,我已经取得了成功。有几个设置还没有完成,但我可以将它分叉,添加功能,并在需要时提供拉取请求。 – GeneBean

+0

你的配置似乎没有错。你有没有检查文件HEADER.html是否对apache进程所有者可读?你是否也检查过selinux是否允许访问它? – alvits

事实证明,这是需要mod_mime。我所要做的只是将include ::apache::mod::mime添加到我的Puppet清单和wala,它工作。我已经在CentOS 6 + scl的原始设置和CentOS 7上验证了这一点。