获取Apache虚拟主机工作的问题

我试图让Apache虚拟主机与Amazon EC2实例一起工作。 我的httpd.conf如下所示

ServerName <elastic_ip>:80 Listen 80 NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /var/www/sites/site1 ServerName www.site1.com </VirtualHost> 

elastic_ip大致类似于Amazon-land中的静态IP。 我的问题是,该网站没有正确加载。 例如,当我在浏览器地址栏中键入以下内容:

 EC2-public-dns .... this works and loads the virtual host site www.EC2-public-dns .... this doesn't load and gives "The requested URL could not be retrieved", ie not any default page elastic-ip .... same as above www.elastic-ip .... same as above 

我没有任何东西在/ etc / hosts文件中,也许我应该? 任何想法,我在做什么错了?


更新:这些是我现在在Godaddy中的设置。

 DNS Manager: Available A @ el.as.tic.ip CNAME www site1.com CNAME ec2-XX-XX-XX-XX.eu-west-1.compute.amazonaws.com @ 

您正在使用基于名称的虚拟主机 。 这要求您有一些将www.site1.com名称映射到实例的弹性IP地址的方法。 您可以使用主机文件来执行此操作,但只能从实例本身进行访问。 通常情况下,您将安排将DNS A或CNAMEloggingparsing为您的实例的弹性IP地址,以获取您希望服务器提供的名称。

 www.site1.com. CNAME site1.com. site1.com. A el.as.tic.ip