我的虚拟主机配置是这样的:为什么我的基于命名的虚拟主机不能正常工作?
Listen 80
...
DocumentRoot "/www/mysite"
...
<Directory "/www/mysite">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
...
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>
...
NameVirtualHost *:80
...
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName theag.com
ServerAlias www.theag.com
DocumentRoot "/www/mysite"
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
虽然本地主机的作品,当我尝试连接到服务器名theag.com如虚拟主机节所述,我得到一个服务器未找到。 我在做什么错?或者我应该怎么做才能使它工作?
p.s. ...
表示之间的配置线。
解决方法:为了进行测试,这是我做了什么:
我刚才编辑的/ etc/hosts文件, 从
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
到
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 theag.com www.theag.com
。
这将使它工作。您现在将使用127.0.0.1作为ip地址。
假设您没有混淆您的域名 - 您的公共DNS区域中没有“www.theag.com”的地址记录。 – jamesallman 2011-12-18 10:00:12
我刚刚编辑了/ etc/hosts,从'127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4'到'127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 theag.com www.theag.com'。我认为它应该现在工作。 – ThinkingMonkey 2011-12-18 10:07:20