我正在尝试让 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 中的静态 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", i.e. 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 @