【发布时间】:2019-09-17 08:12:42
【问题描述】:
环境
- XAMPP 7.2.4 安装在 Windows 10 上
- Apache 在端口 80 和 443 上运行
配置
C:\Windows\System32\drivers\etc\hosts:
127.0.0.1 www.test.local test.local
C:\xampp\apache\conf\httpd.conf:
DocumentRoot "D:/htdocs"
<Directory "D:/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
C:\xampp\apache\conf\extra\httpd-vhosts.conf:
<VirtualHost *:80>
DocumentRoot D:/htdocs
ServerName localhost
<Directory "D:/htdocs">
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot D:/htdocs
ServerName test.local
<Directory "D:/htdocs">
Allow from all
</Directory>
</VirtualHost>
问题
当我启动 Apache 并访问 localhost 时,一切正常。当我尝试访问test.local 时出现问题:浏览器返回无法访问此站点 消息。就像 XAMPP 忽略了在 httpd-vhost.conf 文件中定义的自定义域虚拟主机。在服务器关闭时显示相同的消息。
This site can’t be reached
The webpage at http://test.local/ might be temporarily down or it may have moved permanently to a new web address.
ERR_ADDRESS_INVALID
几天前,设置工作正常,我所做的唯一更改是新软件安装。我的意思是,Apache 配置文件没有变化。
【问题讨论】:
-
你确定上面没有包含
test.local的其他行吗?试试ping test.local。 -
ping返回来自127.0.0.1的响应,并且没有重复的行。