Amazon ec2 - WildCard Sub-Domain
- by Sharanc25
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,
Is it okay if I use Route-53 instead of httpd.conf file for wildcard Sub-Domain ?
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