日期:2014-05-16 浏览次数:20614 次
有一个VPS,空间商给了2个IP.自己有2个域名.服务器是centos6.0 apache 2.2.15
修改httpd.conf 在最下面添加
NameVirtualHost 111.111.111.110:80
NameVirtualHost 111.111.111.111:80
<VirtualHost 111.111.111.110:80>
ServerAdmin rainysia@gmail.com
DocumentRoot /home/www/site1
ServerName www.site1.org
ServerAlias site1.org
DirectoryIndex index.html index.htm index.php index.shtml index.shtm index.tpl
</VirtualHost>
<VirtualHost 111.111.111.111:80>
ServerAdmin rainysia@gmail.com
DocumentRoot /home/www/site2
ServerName www.site2.com
ServerAlias site2.com
DirectoryIndex index.html index.htm index.php index.shtml index.shtm index.tpl
</VirtualHost>
然后重启apache服务器.
然后去域名商那里修改域名的A地址 ,把第二个site2.com的A地址指向111.111.111.111
然后等重新解析就行了.