可以通过IE访问Apache虚拟主机,但不能访问Firefox或Chrome

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (144)

设置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>

系统HOSTS文件

#
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)
提问于
用户回答回答于

没有明确的端口号意味着端口。为端口添加虚拟主机。

扫码关注云+社区

领取腾讯云代金券