使用Apache 2.4 64位VC10構建在Apache Lounge的Win 7機器上,如何啓用文件夾文件視圖?我只想查看每個文件夾中沒有該文件夾中索引文件的文件。Apache 2.4,在瀏覽器中啓用文件夾視圖
這僅用於開發目的。我試過使用選項索引/所有選項並重新啓動我的服務器幾次。我得到的是403 Forbidden。
使用Apache 2.4 64位VC10構建在Apache Lounge的Win 7機器上,如何啓用文件夾文件視圖?我只想查看每個文件夾中沒有該文件夾中索引文件的文件。Apache 2.4,在瀏覽器中啓用文件夾視圖
這僅用於開發目的。我試過使用選項索引/所有選項並重新啓動我的服務器幾次。我得到的是403 Forbidden。
<Directory "/srv/www/htdocs">
Options +Indexes
################
Order allow,deny
Allow from all
</Directory>
對於Apache 2.4,如果您已經啓用爲index.html的這種Directory Indexes或index.php的必須先禁用,然後才能獲得文件夾和文件在Web瀏覽器中顯示。
<Directory "/vhost/www/htdocs/path/to/folder">
DirectoryIndex disabled
Options Indexes
</Directory>
Apache中的指令已經從2.2版改爲2.4版以上。
我運行2.4.7版本,一個基本的虛擬主機文件看起來像這樣:
<VirtualHost 192.168.1.5:80>
DocumentRoot /srv/html/
ServerName some.placeoverthe.rainbow
<Directory /srv/html/>
Options Indexes ## Allows directory browsing.
Require all granted ## Allow all request
</Directory>
</VirtualHost>
採取形式Apache的網站:https://httpd.apache.org/docs/2.4/upgrading.html
以下是新老方法做一些例子相同的訪問控制。
在此示例中,所有請求均被拒絕。
2.2配置:
Order deny,allow
Deny from all
2.4配置:
Require all denied
在這個例子中,所有的請求是允許的。
2.2配置:
Order allow,deny
Allow from all
2.4配置:
Require all granted
在以下示例中,在example.org域中的所有主機允許訪問;所有其他主機都被拒絕訪問。
2.2配置:
Order Deny,Allow
Deny from all
Allow from example.org
2.4配置:
Require host example.org
目錄索引
採取形式Apache的網站:http://httpd.apache.org/docs/2.4/mod/core.html
Options指令控制哪些服務器功能在特定目錄中可用。
選項可以設置爲無,其中的額外功能的情況下沒有被啓用,或者一個或多個以下:
所有
All options except for MultiViews.
ExecCGI
Execution of CGI scripts using mod_cgi is permitted.
FollowSymLinks
服務器將遵循此目錄中的符號鏈接。這是默認設置。
即使服務器遵循符號鏈接,它也不會更改用於匹配部分的路徑名。
FollowSymLinks和SymLinksIfOwnerMatch選項僅適用於部分或.htaccess文件。
省略此選項不應被視爲安全限制,因爲符號鏈接測試受制於可避免的爭用條件。
包括
Server-side includes provided by mod_include are permitted.
IncludesNOEXEC
Server-side includes are permitted, but the #exec cmd and #exec cgi are disabled. It is still possible to #include virtual CGI scripts from ScriptAliased directories.
指標
如果請求映射到目錄的URL並沒有 DirectoryIndex(,例如,index.html),然後mod_autoindex將返回該目錄的格式化列表。
多視圖
內容協商 「多視圖」 使用mod_negotiation模塊允許的。
注: 如果設置比其他任何地方,此選項被忽略,因爲
mod_negotiation模塊需要真正的資源來比較和評價,從。
SymLinksIfOwnerMatch
The server will only follow symbolic links for
which the target file or directory is owned by
the same user id as the link.
作爲一個方面說明:你可能要檢查並確保Apache是否下運行的用戶有權限從目錄中讀取。在Windows上,這可能不是問題,但在Linux上它可能是一個問題。在大多數Linux發行版默認的用戶通常是:
www數據
所以,你會需要更改權限該目錄允許Apache訪問,如果該目錄是由用戶以外的人所擁有Apache下運行。
這對我在Ubuntu 14.04和Apache 2.4.7上工作 –
正常情況下,它是'選項+索引' - 如果您稍後在其他位置覆蓋該設置,請再次使用索引覆蓋它。 – hakre
你有沒有 'LoadModule autoindex_module modules/mod_autoindex.so'在你的httpd.conf中? –
' AllowOverride無 要求全部否認 ' 此行是我的問題。 –