我目前正在尝试使用 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
尝试一下,将 Directory 标签添加到 VirtualHost 标签中
<VirtualHost *:80>
<Directory "E:/xampp/htdocs">
</Directory>
</VirtualHost>