WAMP:apache的虚拟主机2.4.9

时间:2015-04-24 18:46:53

标签: apache wamp virtualhost

我在virtual host创建了WAMP,但浏览器一直在寻找实时网站。我评论了来自httpd.conf的虚拟主机行,我的http-vhost文件看起来像

 <VirtualHost *:80>
   DocumentRoot "D:/wamp/www"
   ServerName localhost
   <Directory "D:/wamp/www">
     Options Indexes FollowSymLinks
     AllowOverride All
     Require local
  </Directory>
</VirtualHost>


<VirtualHost *:80>
  DocumentRoot "D:/Projects/ltl"
  ServerName ltl_new.local
  ServerAlias ltl_new.local
  ErrorLog "logs/mysilverstripe.log"
  <Directory "D:/Projects/ltl">
     Options Indexes FollowSymLinks
     AllowOverride All
     Require local
  </Directory>
 </VirtualHost>

主机文件中的条目看起来像

 127.0.0.1       localhost
 ::1        localhost

 127.0.0.1       ltl_new.local
::1     ltl_new.local

但是当我尝试访问ltl_new.local时,它会找不到服务器,浏览器网址会变为www.ltl_new.localapache version is 2.4.9saveMany。我看过thisthis和许多其他相关问题,但无法解决我的问题。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

不要在域名中使用_(下划线),下划线不是域名中的允许字符。

如果删除HOSTS文件和虚拟主机定义文件_中的httpd-vhosts.conf,那么一切都应该正常工作,否则一切看起来都不错。