Configuring IIS bindings

In IIS, a binding consists of an IP address, a port, and a host header on which the web server listens for requests made to that website. The binding tells IIS how to route inbound HTTP/HTTPS requests.

In this recipe, you create a new website on SRV1 and add bindings to enable the site. In this recipe, you only bind for HTTP.

Getting ready

You need to run this recipe on SRV1 after installing IIS (which you did in the Installing IIS recipe).

How to do it...

  1. Import the WebAdministration module:
    Import-Module -Name WebAdministration
  2. Create and populate a new page:
    $SitePath = 'C:\inetpub\www2' New-Item $SitePath -ItemType Directory | Out-Null $page = @' <!DOCTYPE html> <html> <head><title>Main Page for WWW2.Reskit.Org</title></head> ...

Get Windows Server 2019 Automation with PowerShell Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.