If I want to configure a domain for Apache but not for DNS, is it sufficient to set the A record like this:
A example.com 192.0.2.1
If I also want first.example.com
to be configured is this necessary:
A *.example.com 192.0.2.1
If I want to configure a domain for Apache but not for DNS, is it sufficient to set the A record like this:
A example.com 192.0.2.1
If I also want first.example.com
to be configured is this necessary:
A *.example.com 192.0.2.1
Apache will allow you to use any hostname in
ServerName
and/orServerAlias
directives. There is, from the side of apache, no requirement that the hostnames actually exist in DNS or that, when the DNS record does exist, the DNS record actually points to your Apache web server.That allows you to set up a server and to test your configuration and new website before you make a site live. It is fairly common to add the record of a new site to your "hosts" file to test your new server and website before updating the DNS records and sending your audience to the new web server / website. (Don't forget to remove the entry from your hosts file once the DNS is correct...)
Your audience will not be able to use your new website unless a suitable record exists in your DNS that points them to correct server when they enter the URL of your website in a web browser.
In other words:
There needs to be an explicit DNS record for
first.example.com
OR a wild card*.example.com
that will match.