windows create a site command appcmd
C: \ Windows \ System32 \ inetsrv \ appcmd.exe management SITE virtual site of APP management applications VDIR manage virtual directory APPPOOL management application pool CONFIG General configuration management section WP management processes REQUEST manage HTTP request MODULE management server module BACKUP Management Server configuration backup tRACE use failed request tracing log list lists application pool setconfigure the application pool add to add a new application pool delete to delete the application pool start to start the application pool stop stop the application pool recycle recycle application pools
1. Example: Remove IIS default site
Delete the default site :: C: \ Windows \ System32 \ inetsrv \ the Appcmd.exe the Delete Site " the Default Web Site "
2. Create an application pool web1 web2 web3
C:\Windows\System32\inetsrv\appcmd.exe add apppool /name:"web1" /managedRuntimeVersion:"v4.0" C:\Windows\System32\inetsrv\appcmd.exe add apppool /name:"web2" /managedRuntimeVersion:"v4.0" C:\Windows\System32\inetsrv\appcmd.exe add apppool /name:"web3" /managedRuntimeVersion:"v4.0"
3. Create a site
:: C: \ Windows \ System32 \ inetsrv \ appcmd.exe add site / name: "web1" / bindings: http / *: 80: /applicationDefaults.applicationPool:"web1 "/ physicalPath:" D: \ wwwroot \ web1 "
:: C: \ Windows \ System32 \ inetsrv \ appcmd.exe add site / name: "web1" / bindings: https / *: 443: /applicationDefaults.applicationPool:"web1 "/ physicalPath:" D: \ wwwroot \ web1 "
:: site name: web1
:: site port: 80
:: application pool selection sequence: web1
:: site directory: "D: \ wwwroot \ web1"
C: \ Windows \ System32 \ inetsrv \ the Appcmd.exe the Add site / name: "web1" / Bindings: "HTTP / *: 80:, HTTPS / *: 443:" /applicationDefaults.applicationPool:"web1 "/ physicalPath:" D: \ wwwroot \ web1 "
:: while creating http https site
C:\Windows\System32\inetsrv\appcmd.exe add site /name:"web2" /bindings:https/*:10443: /applicationDefaults.applicationPool:"web2" /physicalPath:"D:\wwwroot\web2"
:: 创建 web2
4, add the site application
C: \ Windows \ System32 \ inetsrv \ the Appcmd.exe the Add App /site.name: " web1 " / applicationPool: " web3 " / path: " / web3 " / \ wwwroot \ web3: physicalPath: d under web1 site at :: Add application :: application name web3 :: application select the application pool web3 :: application to a destination path d: \ wwwroot \ web3
5, add a virtual directory
C: \ Windows \ System32 \ inetsrv \ the Appcmd.exe the Add vdir /app.name: " web1 / " / path: " / HTML " / physicalPath: " D: \ wwwroot \ HTML " :: Add virtual directory under the site web1 :: virtual directory name HTML :: virtual directory pointing head Road d: \ wwwroot \ HTML C: \ Windows \ System32 \ inetsrv \ the Appcmd.exe the Add vdir /app.name: " web1 / web3 " / path: " / HTML2 " / physicalPath: " d: \ wwwroot \ HTML2 " :: Add virtual directory under the application web3 under web1 site :: virtual directory name HTML2 :: virtual directory pointing head Road d: \ wwwroot \ html
6, turn off the default site to launch a new site
C: \ Windows \ System32 \ inetsrv \ the Appcmd.exe STOP Site " the Default Web Site " :: stop the default site Example C: \ Windows \ System32 \ inetsrv \ the Appcmd.exe appcmd Start Site " web1 " C: \ Windows \ System32 \ inetsrv \ the Appcmd.exe appcmd start site " web2 " :: start web1 web2 site
7, cmd add firewall ports
Firewall rule name advfirewall the Add @netsh iis = dir = in Action = Protocol = tcp localPort the allow = 80 , 443
:: add firewall open 80443, name iis
8, import the certificate
-f -importPFX @certutil - the p-passwd D: \ cert \ server.pfx
:: import certificate
:: -p password
:: certification path D: \ cert \ server.pfx