2022-11-04 241
首先介绍我的实验环境
源IIS7服务器
OS:Windows server 2008 Datacenter
机器名称:web1
IP:192.168.1.20/24
安装的IIS Role Services如下
下载 (49.65 KB)
2008-4-27 19:53
下载 (54.08 KB)
2008-4-27 19:53
目标IIS7服务器
OS:Windows server 2008 Datacenter
机器名称:web2
IP:192.168.1.30/24
安装与源IIS7相同的Role Services
笔者的环境中共有里面有三个测试网站,如下图所示
下载 (52.68 KB)
2008-4-27 19:53
网站目录放在E:\web,里面共有3个网站。日志目录放在E:\IISlog,如下图所示
下载 (23.85 KB)
2008-4-27 19:53
其中web目录给iusr和IIS_iusrs分配了只读权限,Administrator和system分配了完全控制权限,如下图所示
Iusr和IIS_iusrs的权限
下载 (22.64 KB)
2008-4-27 19:53
下载 (23.93 KB)
2008-4-27 19:53
Administrators和system的权限
下载 (27.41 KB)
2008-4-27 19:53
下载 (29.02 KB)
2008-4-27 19:53
介绍完实验环境后,接下来介绍IIS7的用户和组,IIS7使用IUSR内建帐号替代了以前的IUSR_MachineName帐号,使用IIS_IUSRS内建组替代以前了IIS_WPG组,IUSR是个内建帐号,他不再需要密码。逻辑上您能够认为他就是NETWORKSERVICE或LOCALSERVICE帐号。内建的帐号和组是由操作系统确保的,这样就能够确保有一个唯一的SID,IIS甚至做得更好,他确保了新的帐号名称和组名称永远不会被本地化。例如,无论您安装的是那种语言版本的Windows,IIS帐号名称将永远是IUSR,而组名称将永远是IIS_IUSRS。
这对于我们将网站迁移到另外一台IIS7的最大好处是可以使用xcopy /o无缝拷贝文档连同他们的所有权和ACL信息到不同的机器上
参考资料Understanding User and Group Accounts with IIS7
URL: http://www.IIS.net/1026/SinglePageArticle.ashx
接下来介绍IIS7网站的配置文件,IIS7涉及到的配置文件就是站点下的Web.config和以及C:\Windows\System32\inetsrv\config下的配置文件,都是基于文本的XML文件。其中C:\Windows\System32\inetsrv\config\applicationHost.config里面的physicalPath定义了每个网站的物理路径,如果目标IIS7服务器的网站目录与源IIS7服务器网站目录不一致,那么在将applicationHost.config复制到目标IIS7服务器后,还要将physicalPath的路径改成目标服务器中的实际路径,以下为web1中C:\Windows\System32\inetsrv\config\applicationHost.config里面涉及physicalPath的内容。
<sites>
<site name=”Default Web Site” id=”1″>
<application path=”/”>
<virtualDirectory path=”/” physicalPath=”%SystemDrive%\inetpub\wwwroot” />
</application>
<bindings>
<binding protocol=”http” bindingInformation=”*:80:” />
</bindings>
</site>
<site name=”hello” id=”2″>
<application path=”/” applicati>
<virtualDirectory path=”/” physicalPath=”E:\web\Hello” />
</application>
<bindings>
<binding protocol=”http” bindingInformation=”*:80:www.hello.com” />
</bindings>
</site>
<site name=”diy” id=”3″>
<application path=”/” applicati>
<virtualDirectory path=”/” physicalPath=”E:\web\diy” />
</application>
<bindings>
<binding protocol=”http” bindingInformation=”*:80:www.diy.com” />
</bindings>
</site>
<site name=”beijing2008″ id=”4″>
<application path=”/” applicati>
<virtualDirectory path=”/” physicalPath=”E:\web\beijing2008″ />
</application>
<bindings>
<binding protocol=”http” bindingInformation=”*:80:www.beijing2008.com” />
</bindings>
</site>
在介绍完后实验环境及相关的背景知识后,接下来就开始进行迁移操作
将目标IIS7服务器也就是web2中执行以下命令,将源IIS7服务器也就是web1的网站内容复制到web2的相同路径
xcopy \\192.168.1.20\e$\web /o /e /h /r e:\web
在web2执行以下命令,将web1的日志复制到web2的相同路径
xcopy \\192.168.1.20\e$\IISlog /o /e /h /r e:\IISlog
在web2执行以下命令,将web1的所有IIS配置文件复制到web2的相同路径
xcopy \\192.168.1.20\c$\Windows\System32\inetsrv\config /o /e /h /r c:\windows\system32\inetsrv\config
复制完成后,检查web2的网站目录权限,发现与web1网站目录所设的权限一致,如下图所示
下载 (24.43 KB)
2008-4-27 19:53
下载 (23.93 KB)
2008-4-27 19:53
然后打开web2的IIS管理界面,发现里面的内容与web1的内容完全一样!
下载 (42.84 KB)
2008-4-27 19:53
测试迁移后的网站是否可以正常访问,在这次实验环境中,通过修改web2的hosts来解释域名
下载 (16.85 KB)
2008-4-27 19:53
在web2打开IE浏览器,分别测试以上三个网址,结果非常成功!
下载 (12.79 KB)
2008-4-27 19:53
下载 (15.58 KB)
2008-4-27 19:53
下载 (32.65 KB)
2008-4-27 19:53
总结:IIS7服务器之间迁移是非常简单的,由于IIS7将所有配置都存在xml文件中,不再使用二进制的metabase来存储配置,这对于迁移一个有成百上千网站的Web服务器无疑提供了更多的手段和方法。在我的实验环境中,只需要通过一个xcopy命令就可以从一个iis7服务器将所有网站完全迁移到另外一个IIS7网站。
以上所述是小编给大家介绍的Win2008 iis7服务器中批量迁移到另外一台IIS7的实现步骤,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对77isp云服务器技术网的支持! 如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!原文链接:https://77isp.com/post/11655.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2023-01-07
网站技术 2022-11-26
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
小游客游戏攻略网游戏攻略网 2024年07月26日
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
扫码二维码
获取最新动态