LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 995|回复: 1

服务器上有两个IP地址,如何让一下IP地址可以支持多个虚拟主机

[复制链接]
发表于 2005-1-18 11:19:11 | 显示全部楼层 |阅读模式

192.168.10.1
192.168.10.2


192.168.10.1为主的IP地址,

<VirtualHost 192.168.10.1:80>
    ServerAdmin webmaster@ccc.net
    DocumentRoot /var/www/ccc
    ServerName www.ccc.com
    ServerAlias ccc.com
    DirectoryIndex index.php index.html index.htm
</VirtualHost>

可以设置多个虚拟主机

但是192.168.10.2确只能设置一个虚拟主机,不然在重启apache的时候他提示192.168.10.2为虚拟设备


如何让192.168.10.2也支持多个虚拟主机的设置
发表于 2005-1-18 12:15:42 | 显示全部楼层
192.168.10.1 server1.domain.tld 用于主服务器
192.168.10.2 server2.domain.tld 用于虚拟主机
别名www.domain.tld用于主服务器,
别名www.otherdomain.tld用于一个虚拟主机,
别名www.sub.domain.tld,*.sub.domain.tld 用于另一虚拟主机,
服务器配置:
...
Port 80
ServerName www.domain.tld
DocumentRoot /www/domain
NameVirtualHost 192.168.10.2
...
<VirtualHost 192.168.10.2>
DocumentRoot /www/otherdomain
ServerName www.otherdomain.tld
...
</VirtualHost>
<VirtualHost 192.168.10.2>
DocumentRoot /www/subdomain
ServerName www.sub.domain.tld
ServerAlias *.sub.domain.tld
...
</VirtualHost>
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表