Forum Moderators: phranque

Message Too Old, No Replies

Pointing domain to Vhosts on a web server

pointing domain vhosts web server apache

         

craig gurnell

5:36 pm on Nov 3, 2009 (gmt 0)

10+ Year Member



Hi
I am abit of a newbie and was wondering if anybody could answer a question for me.

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

jdMorgan

1:55 am on Nov 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The domain name 'knows' nothing...

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

craig gurnell

10:07 am on Nov 4, 2009 (gmt 0)

10+ Year Member



thank you very much jdMorgan, very well phrased answer.
You have answered a lot of questions there.

craig gurnell

10:26 am on Nov 4, 2009 (gmt 0)

10+ Year Member



One more question.
Sorry.
Does the server automatically check the /etc/httpd/vhosts.d/ directory for the location of the VirtualHosts, ServerNames, and ServerAliases?

jdMorgan

1:45 pm on Nov 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Assuming that the server is properly configured, yes it does.

Jim

craig gurnell

5:44 pm on Nov 9, 2009 (gmt 0)

10+ Year Member



thanks again.