1. 開啟主配置檔案 /usr/local/apache2/conf/httpd.conf,
去掉注釋
2. 編輯 httpd-autoindex.conf
新增內容:
alias /test/ "/data/www/"
options indexes multiviews
allowoverride none
require all granted
options許可權說明:
none 沒有任何許可權
all 擁有所有許可權
indexes 瀏覽許可權,即是否允許在目錄下面沒有index.html時顯示目錄
followsymlinks 允許經過此目錄連線到其他目錄
multiviews
允許多重內容被瀏覽,如目錄下有foo.txt檔案,可以通過/foo來訪問,這對於乙個多語言內容站點比較有用
allowoverride,子許可權檔案開關:
定義是否允許目錄下的.htaccess檔案中的許可權生效
none .htaccess中許可權不生效
all 檔案中所有許可權都生效
authconfig
允許使用所有的許可權指令
3. 瀏覽器訪問
www.huangzhenping.cn/test/
Apache 目錄許可權
輸入使用者名稱 密碼後方可訪問home目錄下的檔案 httpd.confoptions indexes multiviews indexes 禁止目錄索引 allowoverride authconfig order deny,allow allow from all options all all...
Apache 目錄列表
1.如何得到 wwwdir 目錄列表中的檔名和目錄名 fs.readdir 2.如何將得到的檔名和目錄名替換到 template.html 中 2.1 在 template.html 中需要替換的位置預留乙個特殊的標記 就像以前使用模板引擎的標記一樣 2.2 根據 files 生成需要的 html ...
apache目錄密碼認證
1 建立使用者密碼檔案。htpasswd c usr local apache passwd 使用者名稱 回車後會提示要求輸入密碼。c是新建檔案。如果新增其他使用者到檔案的話 htpasswd usr local apache passwd 另乙個使用者名稱 2 建立好密碼檔案後,修改httpd v...