如何将多个域指向一个服务器?

时间:2013-11-26 22:00:42

标签: dns vps

我有一个几乎没有使用过的VPS。我希望将我拥有的几个域(通过其他地方的注册商)指向此VPS的不同文件夹。有没有办法做到这一点?

For example:

helloomgwtf.com -> 111.111.111.111/hello
hitherehowareyou.com -> 111.111.111.111/hithere
thirdrandomdomain.com -> 111.111.111.111/random

我对设置内容完全不熟悉,所以真的会对此进行详细解释。

谢谢!

1 个答案:

答案 0 :(得分:4)

您正在寻找虚拟主机。

NameVirtualHost *:80 
<VirtualHost *:80>
  ServerName helloomgwtf.com
  DocumentRoot /var/www/vhosts/hello
</VirtualHost>

<VirtualHost *:80>
  ServerName hitherehowareyou.com
  DocumentRoot /var/www/vhosts/hithere
</VirtualHost>

<VirtualHost *:80>
  ServerName thirdrandomdomain.com
  DocumentRoot /var/www/vhosts/random
</VirtualHost>

Rackspace在此here上有非常好的信息。