1. 程式人生 > >Windows下apache虛擬目錄

Windows下apache虛擬目錄

問題背景:一個儲存檔案的地方,與apache的站點在不同盤上。想通過訪問頁面的形式來訪問儲存檔案的目錄。

首先需要在httpd.conf建立虛擬目錄:

    #
    # ScriptAlias: This controls which directories contain server scripts. 
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "C:/AppServ/www/cgi-bin/"
Alias  /screenshot  "F:/Screenshot"




</IfModule>

其次,需要把訪問許可權開啟

<Directory />
    Options FollowSymLinks ExecCGI Indexes
    AllowOverride None
    Order deny,allow
    Allow from all
    Satisfy all
</Directory>

這麼一來,就可以訪問http://127.0.0.1:80/screenshot了