cPanel & WHM Version 114 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

Always insert SubDomains before the main domain when generating httpd.conf

Frans Bouwmeester shared this idea 8 years ago
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>

Leave a Comment
 
Attach a file