<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[沧海一粟]]></title> 
<link>http://www.dzhope.com/index.php</link> 
<description><![CDATA[Web系统架构与服务器运维,php开发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[沧海一粟]]></copyright>
<item>
<link>http://www.dzhope.com/post//</link>
<title><![CDATA[ServerAlias 应用及测试]]></title> 
<author>jed &lt;jed521@163.com&gt;</author>
<category><![CDATA[服务器技术]]></category>
<pubDate>Tue, 16 Jan 2007 02:05:15 +0000</pubDate> 
<guid>http://www.dzhope.com/post//</guid> 
<description>
<![CDATA[ 
	<br/><br/>如果，想实现多个域名访问同一个网站时，可以使用ServerAlias来实现：<br/><br/>前提条件：<br/>已在域名服务提供商处或自己管理的DNS服务器上，将多个域名或A记录(如：test.com 、<a href="http://www.test.com" target="_blank">www.test.com</a> 、pub.test.com )指向同一个公网IP(如：166.166.166.166)<br/><br/>此例中，Apache中涉及到的相关选项说明：<br/>NameVirtualHost *　　　　　　　　　 &nbsp;(设定虚拟主机的ip) <br/><VirtualHost *>　　　　　　　　　　　(开头设定虚拟主机的ip) <br/>ServerAdmin admin@domain.com　　 (设定虚拟主机的管理者信箱，不用和预设的网站管理者相同) <br/>DocumentRoot /yourdir　　　　　　　 (指定虚拟主机的网站主目录) <br/>ServerName domain.com 　　　　　　 (设定虚拟主机的名称,指定设定虚拟主机的UR) <br/>ServerAlias <a href="http://www.domain.com" target="_blank">www.domain.com</a>　　　　 (设定虚拟主机的別名,例: WWW ) <br/>ErrorLog logs/?? ?? 　　　　　　　　　(虚拟主机发生错误时要记录在哪个目录,可不设.) <br/>TransferLog logs/??　　　　　　　　　(虚拟主机存取记载要存放的个目录,可不设.) <br/></VirtualHost>　　　　　　　　　　　(结束,要设第二组虚拟主机在从开头开始设)<br/><br/><br/>在Apache中的配置：<br/>NameVirtualHost 166.166.166.166<br/><br/><VirtualHost 166.166.166.166><br/>ServerAdmin admin@test.com<br/>DocumentRoot /your/web/file/dir<br/>ServerName test.com<br/>ServerAlias <a href="http://www.test.com" target="_blank">www.test.com</a><br/>ServerAlias pub.test.com<br/>ErrorLog logs/test.com_error_log<br/>TransferLog logs/test.com_transfer_log<br/></Virtualhost><br/><br/><br/>如果没有条件设置域名，在windows环境下可以做如下测试：<br/>修改hosts主机文件，用记事本打开：<br/>C:&#92;WINNT&#92;system32&#92;drivers&#92;etc&#92;hosts<br/><br/># Copyright (c) 1993-1999 Microsoft Corp.<br/>#<br/># This is a sample HOSTS file used by Microsoft TCP/IP for Windows.<br/>#<br/># This file contains the mappings of IP addresses to host names. Each<br/># entry should be kept on an individual line. The IP address should<br/># be placed in the first column followed by the corresponding host name.<br/># The IP address and the host name should be separated by at least one<br/># space.<br/>#<br/># Additionally, comments (such as these) may be inserted on individual<br/># lines or following the machine name denoted by a '#' symbol.<br/>#<br/># For example:<br/>#<br/># &nbsp; &nbsp; &nbsp;102.54.94.97 &nbsp; &nbsp; rhino.acme.com &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# source server<br/># &nbsp; &nbsp; &nbsp; 38.25.63.10 &nbsp; &nbsp; x.acme.com &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# x client host<br/><br/>127.0.0.1 &nbsp; &nbsp; &nbsp; localhost<br/><br/><br/>加入：<br/>166.166.166.166 &nbsp; &nbsp; &nbsp; &nbsp;test.com<br/>166.166.166.166 &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.test.com" target="_blank">www.test.com</a><br/>166.166.166.166 &nbsp; &nbsp; &nbsp; &nbsp;pub.test.com<br/><br/>在CMD下测试PING这三个域名，如果通，就可以测试apache了。 
]]>
</description>
</item><item>
<link>http://www.dzhope.com/post//#blogcomment</link>
<title><![CDATA[[评论] ServerAlias 应用及测试]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.dzhope.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>