Forum Moderators: phranque
If I had a webserver running in a LAMP environment, and I purchased a domain name and pointed the subdomain and @ records to my server, how does the Domain name know to check the /etc/httpd/vhosts.d/ directory for my website configuration files?
would LOVE an answer as am struggling to find a solid answer to this.
thanks
The DNS system returns the IP address of your server in response to DNS lookup requests from clients (e.g. browsers and robots).
Clients then issue an HTTP request, sending the request to that IP address, along with an HTTP "Host" header, specifying the requested hostname (loosely, the 'domain').
The server checks the contents of the HTTP Host header against your VirtualHosts, ServerNames, and ServerAliases, and if a match is found, accesses the specified DocumentRoot in the filesystem to serve requests for that hostname.
Note that the HTTP Host header was introduced as an extension to HTTP/1.0 in order to make name-based virtual hosting possible. For this reason, the hostname is not actually part of the TCP/IP message routing; This routing is done using only the server's IP address, and the hostname is carried along as a request header cobbled into the request.
Jim