命名虚拟主机不在xampp窗口中工作

时间:2017-09-29 14:07:51

标签: xampp virtualhost

我在 extra \ httpd-vhosts.conf

中有以下配置
NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/history"
    ServerName history.test.in
    <Directory "C:/xampp/htdocs/history">
        Options All
        AllowOverride All
        Require all Granted
   </Directory>
</VirtualHost>

另外,我在 apache \ conf \ httpd.conf 文件中启用了此功能,

Include conf/extra/httpd-vhosts.conf

drivers \ etc \ hosts 文件中,我有

127.0.0.1 localhost

127.0.0.1 history.test.in

当我尝试访问http://history.test.in时,网站未加载,但在尝试使用http://localhost/history时,它可以正常运行。我做错了吗?另外,我没有在Apache中看到任何错误日志。

1 个答案:

答案 0 :(得分:0)

上述配置是正确的。虚拟主机无法正常工作的原因是系统中的防火墙阻塞,防病毒软件中断,多个操作系统环境等设置不正确。

这篇文章(大开眼界)帮助我在windows xampp环境中找到了问题:https://serverfault.com/questions/452268/hosts-file-ignored-how-to-troubleshoot 特别是 ipconfig / displaydns DNS命令帮助我发现新主机正常生效。

此外,如果您在系统中运行多个版本的操作系统(Windows 7,vista或Windows 10),请确保编辑正在运行的驱动程序\ etc \ hosts 操作系统的主机文件,而不是闲着一个。

相关问题