为什么所有虚拟主机指向第一个虚拟主机? [英] Why are all virtual hosts pointing to the first virtual host?

查看:176
本文介绍了为什么所有虚拟主机指向第一个虚拟主机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的窗户重新安装一个开发环境,7台笔记本电脑所有子域都指向第一虚拟主机的.conf文件后!?

After reinstalling a development environment on my windows 7 laptop all subdomains are pointing to the first virtual host in the .conf file!?

127.0.0.1       localhost
127.0.0.1       admin.localhost
127.0.0.1       api.localhost
127.0.0.1       cdn.localhost
127.0.0.1       demo.localhost
127.0.0.1       secure.localhost

的httpd.conf

<VirtualHost *:80>
    ServerName admin.localhost
    DocumentRoot c:/wamp/www/admin
</VirtualHost>

<VirtualHost *:80>
    ServerName api.localhost
    DocumentRoot c:/wamp/www/api
</VirtualHost>

<VirtualHost *:80>
    ServerName cdn.localhost
    DocumentRoot c:/wamp/www/cdn
</VirtualHost>

<VirtualHost *:80>
    ServerName secure.localhost
    DocumentRoot c:/wamp/www/secure
</VirtualHost>

所有的子域名都指向第一虚拟主机 admin.localhost ..!?当请求如。 HTTP://cdn.localhost 迪尔 C:/ WAMP /网络/系统管理员被显示

All subdomains are pointing to the first virtual host admin.localhost..!? When requesting eg. http://cdn.localhost the dir c:/wamp/www/admin is showed?

我不知道我在conf做错了什么?这种设置重新安装前工作...嗯

I don't know what I'm doing wrong in the conf? This setup worked before reinstallation... hmmm

推荐答案

这行的注释去掉了NameVirtualHost *:80

重新启动Apache进行更改后,

Restart apache after making the changes

这篇关于为什么所有虚拟主机指向第一个虚拟主机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆