
我目前正在嘗試使用 xampp 和 Apache 來啟動虛擬主機。我無法弄清楚 http-vhosts.config 中的程式碼有什麼問題我已經遵循了許多教程並閱讀了一堆故障排除論壇,但無法理解為什麼如果我嘗試實現虛擬主機,我的 apache 將無法啟動。現在我只是想讓本地主機工作。
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "e:/xampp/htdocs"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<Directory "E:/xampp/htdocs">
Options Includes FollowSymLinks
AllowOverride All
Order Deny,Allow
Allow from all
</Directory>
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost
127.0.0.1 foo.local
答案1
試試這個,將目錄標籤加入到 VirtualHost 標籤中
<VirtualHost *:80>
<Directory "E:/xampp/htdocs">
</Directory>
</VirtualHost>