首页 > 解决方案 > 无法访问此站点 - XAMPP 忽略自定义域虚拟主机

问题描述

环境

在此处输入图像描述

配置

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 配置文件没有变化。

标签: apachexamppvhostshosts

解决方案


如果您的所有堆栈之前都正常工作,请不要像我一样,不要忘记检查某些浏览器扩展是否阻止了您的本地流量,例如与防病毒系统相关的某些扩展。

就我而言,它是卡巴斯基保护扩展。当出现问题时,它会显示以下图形。

在此处输入图像描述


推荐阅读