I find it useful to keep them in different files for a couple of reasons:
Temporary web sites can be easily added or torn down without touching my production sites. For example, I was playing with the Omeka content management system. By keeping it in a separate file, I don’t have to determine what belongs to Omeka (e.g., Directory directives) and what belongs to my production site.
You can use the “a2en…” and “a2dis…” tools to change the configuration. Using the example above, I could a2dissite omeka on my Ubuntu based system and it will remove the link in /etc/apache2/sites-enabled. I could put it back with a2ensite omeka later. (You also have a2enmod and a2dismod for modules, etc.)
The logical separation enforced by using different files, though, mostly protects me from my future self that has forgotten half of what I did. And I need all the help that I can get for that.
Do you know if it’s permissible to have a DNS entry that has a wildcard extension?
i.e. if I own example.com, example.net, example.org, example.ca, etc. can I have an A record that’s: example.* instead of using CNAMEs for each possible suffix?
I don’t know of any way to have a wildcard. I’ll admit that I don’t have an in-depth knowledge of all the options.
My first thought would be to define a virtual host for each variant. One site will have all of the definitions for your site and all the others will have a Redirect directive to point to the primary. An alternative would be to use rewrite instead so the domain name doesn’t change in the visitor’s address bar.
This is one case where I would put all the virtual host definitions in one file since they are essentially a single unit that you would want to control as one and group together for ease of management.
From what I’m reading, it seems there cannot be wildcards in an A record, but there can on a CNAME, but only as the first part. .e.g. *.example.com is ok, but not example.*
Similarly, in the VirtualHosts section, you can’t have any wildcards in the ServerName parameter, but you can have them anywhere in the ServerAlias, it seems.