Amazon ec2 - WildCard Sub-Domain

Posted by Sharanc25 on Server Fault See other posts from Server Fault or by Sharanc25
Published on 2012-06-05T00:50:21Z Indexed on 2012/06/05 4:43 UTC
Read the original article Hit count: 585

I'm running an ec2 instance on ubuntu running lamp stack. I configured my httpd.conf file to support wildcard sub-domain but it didn't work.

My httpd.conf file

 NameVirtualHost *

 <VirtualHost *>
    DocumentRoot /www/example
    ServerName example.com
    ServerAlias *.example.com
</VirtualHost>

I tried all possible solutions but they didn't work. Finally I used amazon Route-53 to setup a wildcard DNS to redirect all *.example.com to example.com. My question is,

  1. Is it okay if I use Route-53 instead of httpd.conf file for wildcard Sub-Domain ?
  2. Is there an error in my httpd.conf file ? (Note: I used the same httpd.conf settings with another hosting provider and it worked perfectly there.)

Additional Information :

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server example.com (/etc/apache2/httpd.conf:1)
         port 80 namevhost example.com (/etc/apache2/httpd.conf:1)
         port 80 namevhost ip-xx-xxx-xx-xxx.ec2.internal (/etc/apache2/sites-enabled/000-default:1)
Syntax OK 

© Server Fault or respective owner

Related posts about amazon-ec2

Related posts about wildcard-subdomain