首页 > 解决方案 > 可以通过 IE 访问 Apache 虚拟主机,但不能通过 Firefox 或 Chrome

问题描述

设置 WAMPserver 后,我的 Apache localhost 站点在 IE、Chrome 和 Firefox 上正确加载。但是,在创建虚拟主机(在本例中为bssb.dev)后,Chrome 和 Firefox 无法检索页面(错误如下所示)。但是,IE 成功加载。即使在创建虚拟主机之后,所有三个浏览器仍然可以成功加载 localhost。

Chrome Error: This site can’t be reached.  bssb.dev refused to connect
Firefox Error: Unable to connect.  Firefox can’t establish a connection to the server at bssb.dev.

应该注意的是,两者都在失败时重定向到https://bssb.dev

我在下面粘贴了 Apache 虚拟主机和系统 HOSTS 文件以供参考。任何指导将不胜感激。

Apache httpd-vhosts.conf

# Virtual Hosts
#
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>


#
<VirtualHost *:80>
    ServerName bssb.dev
    DocumentRoot "c:/users/ian/documents/mywebprojects/bssb"
    <Directory  "c:/users/ian/documents/mywebprojects/bssb/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

#
<VirtualHost *:443>
    ServerName bssb.dev
    DocumentRoot "c:/users/ian/documents/mywebprojects/bssb"
    <Directory  "c:/users/ian/documents/mywebprojects/bssb/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

系统主机文件

#
127.0.0.1 localhost
::1 localhost
127.0.0.1   bssb.dev
::1 bssb.dev

其他详情:

OS: Windows 8.1 (unfortunately)
Firefox v60.0.2 (64-bit)
Chrome v66.0.3359.181 (Official Build) (64-bit)
IE v11.0.9600.19003
WAMPsever v3.1.3 (64-bit)

标签: apachelocalhostwampvirtualhostwampserver

解决方案


没有明确端口号的 HTTPS 表示端口 443。为端口 443 添加虚拟主机。


推荐阅读