PowerShell管理IIS

#导入IIS管理模块
 Import-Module WebAdministration
  
   
  #新建应用程序池 www.xxx.com 
 New-Item iis:\AppPools\www.xxx.com
  Set-ItemProperty iis:\AppPools\www.xxx.com managedRuntimeVersion v4.0 #更改应用程序池版本为4.0,默认为2.0(Windows Server 2008 R2)
 #新建站点 www.xxx.com,主机头为 www.xxx.com,路经为 d:\apidd
 New-Item iis:\Sites\www.xxx.com -bindings @{protocol="http";bindingInformation=":80:www.xxx.com"} -physicalPath d:\apidd
 
 #为站点 www.xxx.com 添加主机头 imageapi.dd2.com
 New-WebBinding -Name "www.xxx.com" -IPAddress "*" -Port 80 -HostHeader imageapi.dd2.com
 
 #为站点 www.xxx.com 更改应用程序池为 www.xxx.com
 Set-ItemProperty IIS:\Sites\www.xxx.com -name applicationPool -value www.xxx.com
 
 #在站点www.xxx.com下新建应用程序cust_account_api ,目录为D:\cust_account_api_new
 new-item iis:\sites\www.xxx.com\cust_account_api -type Application -physicalpath D:\cust_account_api_new
 Set-ItemProperty IIS:\Sites\www.xxx.com\cust_account_api -name applicationPool -value www.xxx.com
 
 #在站点ServerLog下新建虚拟目录cust_account_api ,目录为D:\cust_account_api_new\log
 new-item D:\cust_account_api_new\log -type directory -force 
 new-item iis:\sites\ServerLog\cust_account_api -type VirtualDirectory -physicalpath D:\cust_account_api_new\log
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值