虚拟主机和域名的概念 [英] The concept of virtual host and DNS

查看:170
本文介绍了虚拟主机和域名的概念的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个专门的服务器和mydomain.com(从托管公司收购)。我想从我的域mydomain.com即当我输入mydomain.com从浏览器,它应指向IP专用服务器托管网站(比方说X.X.X.X)专用服务器(和里面一个特定的文件夹)。我有一些疑问如下:

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 i.e. when I enter mydomain.com from browser it should point to the IP(let's say X.X.X.X) of dedicated server(and a particular folder inside it). I have some following queries:

在服务器


  1. 我知道我需要编辑一些文件(如:主机或主机名的文件)的服务器,但我不知道我需要什么编辑确切的文件

  2. 如何添加一个站点中的Apache2启用或网站可用?

在托管公司的控制面板


  1. 哪些记录添加(A或CNAME或电气特性的)?

  2. 我应该在哪里添加DNS(在专用服务器部分或域名部分)?

  3. 这将如何影响域的行为?

总之,问题是:如何在虚拟主机的工作原理和放大器;如何添加DNS?

推荐答案

有关服务器,您需要编辑httpd.conf文件,并添加一个虚拟主机条目,在这里看到:的 http://httpd.apache.org/docs/2.2/vhosts/examples.html 一些例子。阿帕奇具有良好的文档阅读。

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.

它是如何工作的?因为您连接到Apache服务器上的IP地址,Apache服务器不知道你用来连接,除非你告诉它要它的域。在HTTP / 1.1协议,有一个首标主机,它告诉哪个域被用于连接服务器。那么Apache将查找主机名了其配置文件和服务器右页。

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.

在DNS,你可以决定自己的策略。例如,你可以做一个A记录为每个主机和CNAME记录所有的子域。

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.

祝你好运!

这篇关于虚拟主机和域名的概念的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆