[英]Serve documents from alternative document root
我希望Apache服務於
c:/Apache24/htdocs和
<VirtualHost *:80>
DocumentRoot "c:/Apache24/htdocs"
ServerName test.localhost
Options Indexes FollowSymLinks
<Directory "D:/www">
AllowOverride All
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
在我的Windows本地計算機上響應。
在httpd-vhosts.conf中,我正在嘗試:
<VirtualHost *:80> DocumentRoot "c:/Apache24/htdocs" ServerName test.localhost Options Indexes FollowSymLinks <Directory "D:/www"> AllowOverride All Order Deny,Allow Deny from all Allow from 127.0.0.1 </Directory> </VirtualHost>
並在主機中
127.0.0.1 test.localhost
但是瀏覽到http://test.localhost會在以下目錄下顯示目錄列表
C:/ htdocs目錄被顯示?
我是否對此更加接近:
Alias c:/Apache24/htdocs D:/www <Directory c:/Apache24/htdocs> Require all granted </Directory>
如果是這樣,我應該在哪里添加它? 注意:我想從D:/存儲和提供Web文檔,因為C:/現在已經很滿了。
檢查您的虛擬主機之前是否有一行: NameVirtualHost *:80
。 通常應該已經在那里了,但是要檢查一下。
將主機更改為僅指向一個文件夾,例如:
<VirtualHost *:80>
DocumentRoot "D:/www"
ServerName localserver
Options Indexes FollowSymLinks
<Directory "D:/www">
AllowOverride All
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
創建從c:/Apache24/htdocs
到例如D:/www/apache
文件夾的符號鏈接。 然后,您可以從URL訪問c:/Apache24/htdocs
文件夾:
localserver/apache
閱讀有關符號鏈接的更多信息: http : //en.wikipedia.org/wiki/NTFS_symbolic_link
另一個選擇是創建兩個URL(域)和虛擬主機,例如(在上面添加以下內容):
<VirtualHost *:80>
DocumentRoot "c:/Apache24/htdocs"
ServerName other.localserver
Options Indexes FollowSymLinks
<Directory "c:/Apache24/htdocs">
AllowOverride All
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
在您的主機中:
127.0.0.1 localserver other.localserver
在安裝了WAMP的Windows 7上
C:\Apache24和送出文件
C:\\ Apache24 \\ htdocs目錄您可能想改為從D驅動器提供文檔,因為C快滿了。 去:
127.0.0.1 site1.dev
127.0.0.1 site2.dev
D:\www\apache
並編輯:
C:\\ WINDOWS \\ SYSTEM32 \\ DRIVERS \\ ETC \\主機
127.0.0.1 site1.dev 127.0.0.1 site2.dev
現在,您應該可以(本地)提供您的Web文檔了
d:\\ WWW \\阿帕奇無需符號鏈接。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.