【求助】如何設定 Apache 不列出網站目錄下的檔案



贊助商連結


alderm
2005-03-27, 12:12 AM
apache要怎麼設定!
使用者才不能瀏覽網站的目錄?
因為我目前的設定使用者能瀏覽網站目錄!
我想修正!讓使用者無法瀏覽目錄!
如下:

我想要設定就是
如果目錄下沒有任何網頁的話!
就出現錯誤的訊息!
而不是以資料夾的模式瀏覽

http://www.signlanguage.idv.tw/pic/apache.png

贊助商連結


nopy
2005-03-27, 12:21 AM
apache要怎麼設定!
使用者才不能瀏覽網站的目錄?
因為我目前的設定使用者能瀏覽網站目錄!
我想修正!讓使用者無法瀏覽目錄!
編輯 apache 的設定檔
在網頁目錄 <Directory ..> 的設定中,找到 Options 一項
然後把 Indexes 拿掉就可以了

阿 土
2005-03-27, 12:32 AM
apache要怎麼設定!
使用者才不能瀏覽網站的目錄?
因為我目前的設定使用者能瀏覽網站目錄!
我想修正!讓使用者無法瀏覽目錄!
如下:
http://www.signlanguage.idv.tw/clip

不要載入 autoindex_module 即可
httpd.conf 刪掉這兩行

LoadModule autoindex_module libexec/mod_autoindex.so
AddModule mod_autoindex.c

alderm
2005-03-27, 12:39 AM
感謝樓上兩位大哥!
搞定了!
兩種都可以!

weberbuy
2005-03-27, 12:41 PM
我是使用Apache 2.0.52 (Win32),去掉options裡的Indexes可以。 :)

但是用土大說的…會讓apache無法啟動耶… :|||:
而且也找不到這行:AddModule mod_autoindex.c

PaytonG
2005-03-27, 04:08 PM
編輯 apache 的設定檔
在網頁目錄 <Directory ..> 的設定中,找到 Options 一項
然後把 Indexes 拿掉就可以了

您說的應該是這句裡的 Indexes 對吧!!~~~
<Directory />
Options FollowSymLinks ExecCGI Indexes
AllowOverride None
</Directory>
這個的 Indexes 拿掉是沒有效的~~~~

還是你說的是這段設定裡的呢!???
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks MultiViews ExecCGI
要拿掉上面這句的 Indexes 才有做用呢!!!~~~

nopy
2005-03-27, 10:34 PM
還是你說的是這段設定裡的呢!???
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks MultiViews ExecCGI
要拿掉上面這句的 Indexes 才有做用呢!!!~~~

....

Options 一般是包在 <Directory ...> 裡面
一份設定檔可能會有好幾個 <Directory ...>
你當然要改那一個你不希望有 Indexes 功能的啊!

isakira
2005-03-27, 10:46 PM
如果完全不想動httpd.conf
可以在每個資料夾都丟一個 index.html
這樣就不會列出目錄了。

PaytonG
2005-03-28, 11:05 AM
....

Options 一般是包在 <Directory ...> 裡面
一份設定檔可能會有好幾個 <Directory ...>
你當然要改那一個你不希望有 Indexes 功能的啊!


這是appserv每個版本設定都不一定一樣的!!!~~
我用的就是2.5.3版!!~~~