使用者工具

網站工具


linux:web:apache_dir

Apache 虛擬目錄

一般Linux Web資料放置在此目錄下/var/www/html,若此目錄下有AA及BB資料夾,那web瀏覽時就呈現 http://localhost/AA/http://localhost/BB/等狀態。 假若http://localhost/test是此狀況下,指定的實體目錄希望指向到/var/test,這就必須使用到虛擬目錄功能。

設定檔表示法

 Alias /test/ "/var/test" #實體目錄
#實體目錄權限設定
<Directory "/var/test">
    Order allow,deny
    Allow from all
</Directory>

啟動及測試

#/etc/init.d/httpd configtest
Syntax OK
#/etc/init.d/httpd restart
#links http://localhost/test

參考資料

linux/web/apache_dir.txt · 上一次變更: 2013/07/06 01:28 (外部編輯)