Windows 2019
Sponsored Link

IIS : Use Default Web Site2019/08/29

 
After installing IIS, a Web Site setting [Default Web Site] is configured.
If you use [Default Web Site], refer to follows.
[1] Run PowerShell with Admin Privilege and Configure.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

# show Sites list : [Default Web Site] is only set
PS C:\Users\Administrator> Get-Website 

Name             ID   State      Physical Path                  Bindings
----             --   -----      -------------                  --------
Default Web Site 1    Started    %SystemDrive%\inetpub\wwwroot  http *:80:

# [Physical Path] is the Document Root
PS C:\Users\Administrator> Get-ChildItem C:\inetpub\wwwroot 

    Directory: C:\inetpub\wwwroot

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        8/27/2019   6:57 PM            703 iisstart.htm
-a----        8/27/2019   6:57 PM          99710 iisstart.png

# verify accesses : [iisstart.htm] responds
PS C:\Users\Administrator> Invoke-WebRequest localhost 

StatusCode        : 200
StatusDescription : OK
Content           : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
.....
.....
ParsedHtml        : System.__ComObject
RawContentLength  : 703

# confirm default documents
PS C:\Users\Administrator> Get-WebConfigurationProperty -Filter "//defaultDocument/files/add" -PSPath "IIS:\Sites\Default Web Site" -Name "value" | select value 

Value
-----
Default.htm
Default.asp
index.htm
index.html
iisstart.htm

# create a test page under the Document Root and verify working
# [Write-Output] generates with UTF-16, so specify encoding explicitly with [Out-File]
PS C:\Users\Administrator> Write-Output "IIS Default Start Page" | Out-File C:\inetpub\wwwroot\Default.htm -Encoding Default 

# verify accesses
# for [curl.exe], specify extension ⇒ if not specify extension, [curl] is an Alias from [Invoke-WebRequest]
PS C:\Users\Administrator> curl.exe localhost 
IIS Default Start Page
IIS : Use Default Web Site (GUI)
 
On GUI configuration, set like follows.
[2] Run [Start] - [Server Manager] and Click [Tools] - [Internet Information Services (IIS) Manager].
[3] Open items on left pabe, [Default Web Site] is configured.
[4] Select [Default Web Site] and Click [Advanced Settings...], then it's possible to confirm settings like [Physical Path] (Document Root) and so on.
[5] Open [Default Document], then it's possible to confirm default documents.
[6] You can see default documents.
[7] Create a test page under the Physical Path (Document Root) and verify accesses with Web browser.
Matched Content