源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Win2008 iis7服务器中批量迁移到另外一台IIS7的实现步骤

  • 时间:2021-06-24 10:05 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Win2008 iis7服务器中批量迁移到另外一台IIS7的实现步骤
首先介绍我的实验环境 源IIS7服务器 OS:Windows server 2008 Datacenter 机器名称:web1 IP:192.168.1.20/24 安装的IIS Role Services如下 [img]http://files.jb51.net/upload/20090324180631684.jpg[/img] [img]http://files.jb51.net/upload/20090324180631759.jpg[/img] 目标IIS7服务器 OS:Windows server 2008 Datacenter 机器名称:web2 IP:192.168.1.30/24 安装与源IIS7相同的Role Services 笔者的环境中共有里面有三个测试网站,如下图所示 [img]http://files.jb51.net/upload/20090324180632513.jpg[/img] 网站目录放在E:\web,里面共有3个网站。日志目录放在E:\IISlog,如下图所示 [img]http://files.jb51.net/upload/20090324180633185.jpg[/img] 其中web目录给iusr和IIS_iusrs分配了只读权限,Administrator和system分配了完全控制权限,如下图所示 Iusr和IIS_iusrs的权限 [img]http://files.jb51.net/upload/20090324180633365.jpg[/img] [img]http://files.jb51.net/upload/20090324180633100.jpg[/img] Administrators和system的权限 [img]http://files.jb51.net/upload/20090324180633383.jpg[/img] [img]http://files.jb51.net/upload/20090324180633483.jpg[/img] 介绍完实验环境后,接下来介绍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: [url=http://www.iis.net/1026/SinglePageArticle.ashx]http://www.IIS.net/1026/SinglePageArticle.ashx[/url] 接下来介绍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:[url=http://www.hello.com/]www.hello.com[/url]" /> </bindings> </site> <site name="diy" id="3"> <application path="/" applicati> <virtualDirectory path="/" physicalPath="E:\web\diy" /> </application> <bindings> <binding protocol="http" bindingInformation="*:80:[url=http://www.diy.com/]www.diy.com[/url]" /> </bindings> </site> <site name="beijing2008" id="4"> <application path="/" applicati> <virtualDirectory path="/" physicalPath="E:\web\beijing2008" /> </application> <bindings> <binding protocol="http" bindingInformation="*:80:[url=http://www.beijing2008.com/]www.beijing2008.com[/url]" /> </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网站目录所设的权限一致,如下图所示 [img]http://files.jb51.net/upload/20090324180634939.jpg[/img] [img]http://files.jb51.net/upload/20090324180634382.jpg[/img] 然后打开web2的IIS管理界面,发现里面的内容与web1的内容完全一样! [img]http://files.jb51.net/upload/20090324180634316.jpg[/img] 测试迁移后的网站是否可以正常访问,在这次实验环境中,通过修改web2的hosts来解释域名 [img]http://files.jb51.net/upload/20090324180634891.jpg[/img] 在web2打开IE浏览器,分别测试以上三个网址,结果非常成功! [img]http://files.jb51.net/upload/20090324180635786.jpg[/img] [img]http://files.jb51.net/upload/20090324180635667.jpg[/img] [img]http://files.jb51.net/upload/20090324180635691.jpg[/img] 总结:IIS7服务器之间迁移是非常简单的,由于IIS7将所有配置都存在xml文件中,不再使用二进制的metabase来存储配置,这对于迁移一个有成百上千网站的Web服务器无疑提供了更多的手段和方法。在我的实验环境中,只需要通过一个xcopy命令就可以从一个iis7服务器将所有网站完全迁移到另外一个IIS7网站。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部