2015-05-24 24 views
0

我正在嘗試使用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

回答

0

事實證明,這是需要mod_mime。我所要做的只是將include ::apache::mod::mime添加到我的Puppet清單和wala,它工作。我已經在CentOS 6 + scl的原始設置和CentOS 7上驗證了這一點。