Is it possible in the apache config file to use regular expressions in the ServerName and ServerAlias field to have 2 domains use the exact same config file vs. creating 2 for each domain. I was trying something like this, but was getting an error from Apache:
<VirtualHost *:80> ServerAdmin [email protected] ServerName [test.com|test.net] ServerAlias [www.test.com|www.test.net] DocumentRoot /var/www/test.com/public_html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
<VirtualHost>as the first in the configuration, removeServerNameandServerAliasand use it as the default. When Apache cannot match the name, it uses the first<VirtualHost>if finds from the top. But that means that any connection to reach your port 80 would match that one as well. For that type of config, I never combine two sites together (in company servers), since I want my logs to be separated for each site. And sites come and go, so it is easier when they are not coupled. YMMV