Hi everyone,

In previous post, you learned how to create Nano Server image on two different ways, with PowerShell and Nano Server Image Builder. In this post, I will show you how to create Nano Server as IIS and make functional web sites.

Before start, I want to share some information with you about Nano Server as IIS. You can install the IIS server role on Nano Server by using the -Package Microsoft-NanoServer-IIS-Package parameter during creating image file. By default, IIS will be installed with only needed IIS Features (Static Content, IISAdministration module for Windows PowerShell, HTTP Logging …), but all other applicable features can be installed later with DISM or Get-WindowsOptionalFeature.

Of course, IIS on Nano Server has advantages and disadvantages.

Advantages (as usual)

  • Small footprint
  • Faster reboot
  • Less patches

Disadvantages

  • No GUI remote control
  • Support only ASP.Core
  • Classic ASP or Asp.Net will not run on Nano Server

Supported frameworks

  • ASP.Core
  • Java
  • PHP
# Copy Nano Server folder from installation media to local drive
Copy-Item F:\NanoServer -Recurse -Destination C:\

# Import Nano Server module
Import-Module C:\NanoServer\NanoServerImageGenerator\NanoServerImageGenerator.psm1

# Create IIS Nano Server image
New-NanoServerImage `
    -DeploymentType Guest `
    -Edition Datacenter `
    -MediaPath F: `
    -BasePath C:\NanoServer `
    -TargetPath D:\VMs\NanoIIS\NanoIIS.vhdx `
    -ComputerName NanoIIS `
    -Package Microsoft-NanoServer-IIS-Package

*Note that media drive (F: in my case) and image destination (D:\VMs\NanoIIS\NanoIIS.vhdx in my case), can vary depending on the configuration.

Once when you create VM and start Nano Server, you will have completely functional IIS on Nano Server. But, as I said earlier, default IIS on Nano Server has a limited set of features and functionalities. If you need to change some of these parameters, you can do that through PowerShell remoting.

# Check enabled IIS feature and manage them with DISM
DISM /online /get-features /format:table | more
DISM /online /enable-feature /featurename:"IIS-HttpLogging"

# Check enabled IIS feature and manage them with PowerShell - Install all disabled features
Get-WindowsOptionalFeature -Online | Where {$_.State -eq "Disabled"}
Get-WindowsOptionalFeature -Online | Where {$_.State -eq "Disabled"} | Enable-WindowsOptionalFeature -Online

# Deploy new website
Import-Module IISAdministration
New-IISSite `
 -Name "NewSiteName" `
 -PhysicalPath "New App Path" `
 -BindingInformation *:80:www.newsitename.com

# If you want to add new site to another port, remember that you need to create FW rule
New-NetFirewallRule -DisplayName Port8080 -Protocol TCP -LocalPort 8080 -Enabled True

 

Now you can start creating web sites on Nano Server IIS 😉

Leave a Reply

Your email address will not be published. Required fields are marked *