想把Apache2.4作爲文件服務器,設置好根目錄後,啓動httpd,打開瀏覽器訪問httpd,直接顯示forbidden,無法訪問。查看日誌,報錯信息爲AH01276: Cannot serve directory /home/data/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive
但是在URL後加上目錄名可以訪問
修改httpd.conf文件
<Directory "/home/data">
Options FollowSymLinks Indexes
AllowOverride None
Require all granted
</Directory>
Indexes代表文件列表目錄
重啓httpd依然如此
後來查看conf.d/welcome.conf文件,發現Options後邊有個-Indexes,其中這個“-”號表示禁止的意思,所以這個設置的意思就是根目錄“/”下不支持文件列表,自動跳轉到403頁面
把Indexes前面的“-”號去掉,重啓服務器就可以了