绑定服务器与www工作但不与非www

我刚刚安装了我的VPS与centos和使用绑定服务器添加域到它。 我唯一的问题是,当我用www访问域。 它不工作。 我调查了我的问题后,我发现通过添加一个IN CNAME到域应该工作,但它没有。

以下是我的logging文件的外观:

$ttl 38400 senatoronline.ro. IN SOA ns1.bebliuc.ro. bebliuc\.george.gmail.com. ( 1365567122 5M 3600 604800 38400 ) senatoronline.ro. IN NS ns1.bebliuc.ro. senatoronline.ro. IN NS ns2.bebliuc.ro. senatoronline.ro. IN A 176.223.127.161 ns1.bebliuc.ro. IN A 176.223.127.161 ns2.bebliuc.ro. IN A 176.223.127.161 senatoronline.ro. IN MX 10 mail.bebliuc.ro. www.senatoronline.ro. IN CNAME senatoronline.ro. *.senatoronline.ro. IN A 176.223.127.161 

LE:VHosts文件

 <VirtualHost *:80> ServerName senatoronline.ro ServerAlias www.senatoronline.ro ServerAdmin [email protected] DocumentRoot /var/www/senatoronline.ro <Directory /var/www/senatoronline.ro> AllowOverride All Allow from all </Directory> </VirtualHost> 

任何帮助,这是非常赞赏。

谢谢

这两个虚拟主机工作正常。

 jamzed@lnxwrk:~$ lwp-request -Sde senatoronline.ro GET http://senatoronline.ro 403 Forbidden Connection: close Date: Wed, 11 Sep 2013 07:20:40 GMT Accept-Ranges: bytes Server: Apache/2.2.23 (CentOS) Content-Length: 3700 Content-Type: text/html; charset=UTF-8 Client-Date: Wed, 11 Sep 2013 07:20:41 GMT Client-Peer: 176.223.127.161:80 Client-Response-Num: 1 Title: Test Page for the Nginx HTTP Server on Fedora jamzed@lnxwrk:~$ lwp-request -Sde www.senatoronline.ro GET http://www.senatoronline.ro 403 Forbidden Connection: close Date: Wed, 11 Sep 2013 07:20:43 GMT Accept-Ranges: bytes Server: Apache/2.2.23 (CentOS) Content-Length: 3700 Content-Type: text/html; charset=UTF-8 Client-Date: Wed, 11 Sep 2013 07:20:43 GMT Client-Peer: 176.223.127.161:80 Client-Response-Num: 1 Title: Test Page for the Nginx HTTP Server on Fedora 

如果您尝试获取www.senatoronline.ro,究竟发生了什么? 这是一个有关DNS的问题? 或Apacheconfiguration? 尝试解决两个主机senatoronline.ro和www.senatoronline.ro并检查你是否会得到相同的IP地址。 你为了testing目的修改了/ etc / hosts吗?

DNS看起来很好,但是你可能需要一个Apache的虚拟主机文件的等价的通配符条目 – 例如:

  ServerAlias *.senatoronline.ro 

然后Apache会收到这些请求。