我最近在Ubuntu 11.10中configuration了虚拟主机。 但是,无论我键入的网站,它总是redirect到本地主页。
这是我的“我们的testing网站”文件:
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/zftut/public <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/zftut/public/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory>
这是我的“etc / hosts”文件:
127.0.0.1 localhost 127.0.0.1 our-test-site.local 127.0.0.1 zftut.local 127.0.1.1 System.B System
现在,当我尝试去“zftut.local”,它将我redirect到本地主页,告诉我这个:
有用!
这是此服务器的默认网页。
Web服务器软件正在运行,但尚未添加内容。
我究竟做错了什么? 我提到了build立虚拟主机的“本”教程。
你没有告诉我们你的完整的Apacheconfiguration。 我认为你仍然有默认的VH定义。
您需要添加ServerName
行:
ServerName www.zftut.local ServerAlias zftut.local *.domain.tld
ServerAlias
是可选的,并帮助你得到正确的几个名称VH。 在本例中,所有以zftut.local
结尾的DNS名称。 当然,您需要为每个要使用的名称设置正确的DNSlogging(或主机文件中的行)。