在Amazon EC2上创建子域名& Route53

时间:2016-05-03 04:30:15

标签: apache amazon-web-services amazon-ec2 subdomain amazon-route53

我觉得这应该比它更容易,但是我们在2016年,Apache仍然使配置变得神秘。我想要的是简单地在与主站点不同的目录中托管子域。这或多或少是我现在所拥有的:

# Start of httpd.conf file
# Some crap
# Some <Directory> crap (this should be clearer from Apache)
#

<VirtualHost *:80>
  DocumentRoot "/var/www/html/mainsite"
  ServerName www.mycomp.com
</VirtualHost>

<VirtualHost *:80>
  DocumentRoot "/var/www/html/blog"
  ServerName blog.mycomp.com
</VirtualHost>

# End of httpd.conf file

但是,当我重新启动httpd时,只有blog.mycomp.com URL工作,而默认的URL(www)会引发500服务器错误。 www 博客子域名在Route53中都有 A 记录,指向ElasticIP,并且两者都解析,因此它不是DNS问题。有趣的是,当我删除博客<VirtualHost>时,它运行正常。我已将其缩小到DocumentRoot行,但无法弄清楚为什么我无法从服务器上的不同文件夹中获取2个(或更多)子域名。

有人可以解释为什么一个域有效,另一个域没有,以及我需要做些什么来修复?谢谢!

0 个答案:

没有答案