Always insert SubDomains before the main domain when generating httpd.conf
Open Discussion
In httpd.conf, VirtualHost entries for SubDomains are (random?) listed after the main domain entry.
This prevents subdomains from being served when the main domain includes a wildcard ServerAlias.
For example in the below, blog.mydomain.com would not be served.
Putting the blog.mydomain.com entry before the mydomain.com entry would solve the issue.
<VirtualHost 1.2.3.4:80>
ServerName mydomain.com
ServerAlias *.mydomain.com http://www.mydomain.com
DocumentRoot /home/mydomain/public_html
....
</VirtualHost>
<VirtualHost 1.2.3.4:80>
ServerName blog.mydomain.com
ServerAlias http://www.blog.mydomain.com
DocumentRoot /home/mydomain/public_html/blog
....
</VirtualHost>
Replies have been locked on this page!