基于IP和域的虚拟主机

时间:2014-12-02 05:30:10

标签: apache virtualhost vps

我的VPS给了我16个IP v6地址,我想要托管16个域,我希望它们的每个域都有自己唯一的ipv6地址。

如果我想这样做,我该怎么办?很多研究告诉我,我应该使用虚拟主机,这是怎么做的?我应该使用像webmin这样的简单面板吗?

2 个答案:

答案 0 :(得分:1)

如果您正在使用Apache,那么它非常简单。按照http://httpd.apache.org/docs/2.2/vhosts/ip-based.html上的说明使用ipv6表示法(方括号中的ipv6地址)而不是裸ipv4地址。确保为16个地址中的每个地址指定Listen指令,并为每个地址指定VirtualHost部分。

e.g:

Listen [2001:0db8:100::1]:80

<VirtualHost [2001:0db8:100::1]:80>
    ServerName www.example.com
    ...more config here...
</VirtualHost>

答案 1 :(得分:1)

或者您可以将您的IPV6地址映射到DNS中的域名

[2001:0db8:100 :: 1 - &gt;域1 [2001:0db8:100 :: 2 - &gt;域2

在Apache中使用基于名称的虚拟主机,这使得通过浏览器访问应用程序更具可读性:http://httpd.apache.org/docs/2.2/vhosts/name-based.html

<VirtualHost *:80>
ServerName www.domain1.com
DocumentRoot /www/domain1
</VirtualHost>

<VirtualHost *:80>
 ServerName www.domain2.com
 DocumentRoot /www/domain2
</VirtualHost>
相关问题