环境
- 在 Windows 10 上安装 XAMPP 7.2.4
- 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 配置文件没有变化。
最佳答案
关于apache - 无法访问此站点 - XAMPP 忽略自定义域虚拟主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55890893/