I have a dedicated server and a mydomain.com (bought from a hosting company). I want to host a website from my dedicated server with the domain mydomain.com ie when I enter mydomain.com from browser it should point to the IP(let's say XXXX) of dedicated server(and a particular folder inside it). I have some following queries:
In Server
In Hosting Company control Panel
in short the question is: How the virtual host works & how to add DNS? .
For the server, you need to edit the httpd.conf file and add a VirtualHost entry, see here: http://httpd.apache.org/docs/2.2/vhosts/examples.html for some examples. Apache has good documentation, read it.
How does it work? Because you connect to the Apache server on an IP-address, the apache server does not know which domain you used to connect to, unless you tell it to it. In the HTTP/1.1 protocol, there is a header 'Host' that tells the server which domain was used to connect. Apache will then look the hostname up in its configuration files and server the right page.
In the DNS, you can decide your own policy. You could for example make an A record for each host and CNAMEs for all the subdomains.
There is a lot of information to be found on this subject on the internet. Google is your friend.
Good luck!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.