WindowsPublished on May 26, 20266 min read

How to install IIS on Windows Server

IIS (Internet Information Services) is Microsoft's web server, included in Windows Server at no extra license cost. This guide shows how to install IIS on a Windows Server 2025 VPS with Server Manager, PowerShell or DISM, then check the installation, create a first site, add PHP and open the ports. First connect to the VPS as administrator, as described in Connect to a Windows VPS via RDP.

IIS by Windows Server version

OuiHeberg Windows VPS are delivered with Windows Server 2025. All recent versions ship IIS 10.0, and the commands in this guide are the same everywhere.

Windows ServerIIS versionEnd of extended support
Windows Server 2025IIS 10.0 (build 26100)November 2034
Windows Server 2022IIS 10.0 (build 20348)October 2031
Windows Server 2019IIS 10.0 (build 17763)January 2029
Windows Server 2016IIS 10.0 (build 14393)January 2027

IIS serves static sites and ASP.NET, .NET or PHP applications. It hosts several sites on one server through bindings, and handles HTTPS certificates and HTTP/2.


Install IIS with Server Manager

Windows labels are quoted in English, the language of the delivered system.

  1. Open Server Manager. It also starts when you log in.

  2. Click Manage › Add Roles and Features.

  3. Go past Before You Begin, choose Role-based or feature-based installation, then select your server.

  4. In Server Roles, tick Web Server (IIS). In the window that opens, click Add Features.

  5. In Features, add ASP.NET if needed, under .NET Framework 4.8 Features. In Role Services, add for example WebSocket Protocol, under Application Development.

  6. Review the summary, click Install, then Close at the end.

Server Manager dashboard with the Add roles and features link


Install IIS with PowerShell

PowerShell is faster and can be replayed as is. Open it as administrator. This command installs the role and the IIS management console.

Install-WindowsFeature -name Web-Server -IncludeManagementTools

This variant also adds ASP.NET 4.x, the management tools and WebSocket.

Install-WindowsFeature -name Web-Server, Web-Asp-Net45, Web-Mgmt-Tools, Web-WebSockets

Web-Asp-Net45 adds ASP.NET 4.x. The similar name Web-ASP is the old classic ASP. The command shows Success as True. If Restart Needed says Yes, plan a restart. This command lists the installed IIS components.

Get-WindowsFeature -Name Web-* | Where-Object {$_.InstallState -eq "Installed"}

Install IIS with DISM

Run DISM in an administrator command prompt. /norestart prevents an automatic restart.

dism /online /enable-feature /featurename:IIS-WebServerRole /all /norestart

These two commands add ASP.NET 4.5 and later, then WebSocket.

dism /online /enable-feature /featurename:IIS-ASPNET45 /all
dism /online /enable-feature /featurename:IIS-WebSockets /all

For a full installation, with authentication, compression, logging and ASP.NET. The ^ character continues the command on the next line.

dism.exe /Enable-Feature /Online /All ^
/FeatureName:IIS-DefaultDocument ^
/FeatureName:IIS-DirectoryBrowsing ^
/FeatureName:IIS-HttpErrors ^
/FeatureName:IIS-StaticContent ^
/FeatureName:IIS-HttpLogging ^
/FeatureName:IIS-RequestMonitor ^
/FeatureName:IIS-HttpCompressionStatic ^
/FeatureName:IIS-HttpCompressionDynamic ^
/FeatureName:IIS-RequestFiltering ^
/FeatureName:IIS-BasicAuthentication ^
/FeatureName:IIS-WindowsAuthentication ^
/FeatureName:IIS-NetFxExtensibility45 ^
/FeatureName:IIS-ASPNET45 ^
/FeatureName:IIS-ISAPIExtensions ^
/FeatureName:IIS-ISAPIFilter ^
/FeatureName:IIS-ManagementConsole

DISM ends with "The operation completed successfully".


Check that IIS works

On the VPS, open a browser at http://localhost. The blue IIS welcome page confirms that the server responds. Also check that port 80 is listening.

Test-NetConnection -ComputerName localhost -Port 80

The TcpTestSucceeded line should be True. To open IIS Manager, press Win + R, type inetmgr and press Enter.


Create your first site

  1. Create the site folder and a test page.

    New-Item -ItemType Directory -Path "C:\inetpub\example-site"
    Set-Content -Path "C:\inetpub\example-site\index.html" -Value "<h1>IIS OK</h1>"
    
  2. In IIS Manager, right-click Sites, then Add Website.

  3. Fill in Site name (example-site), Physical path (C:\inetpub\example-site) and the binding: type http, port 80, and your domain in Host name. Click OK.

You can create the same site with one command, using the IISAdministration module.

New-IISSite -Name "example-site" -PhysicalPath "C:\inetpub\example-site" -BindingInformation "*:80:www.example.com"

Each site runs in an application pool. IIS Manager creates one named after the site, whereas New-IISSite uses DefaultAppPool. In Application Pools, check the .NET CLR version: v4.0 for ASP.NET, No Managed Code for ASP.NET Core and PHP. Then open http://localhost or the VPS public IP to see the page.


Add PHP to IIS

The Web Platform Installer, which old tutorials still mention, has been retired by Microsoft. PHP is installed by hand, with FastCGI.

  1. Install the CGI role service, which brings FastCGI.

    Install-WindowsFeature -Name Web-CGI
    
  2. On windows.php.net, download the stable PHP release as Non Thread Safe x64, the build recommended with FastCGI. Extract it to C:\PHP. Also install the Visual C++ redistributable listed on the same page.

  3. In an administrator command prompt, register PHP with IIS and add index.php to the default documents.

    %windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='C:\PHP\php-cgi.exe']
    %windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='C:\PHP\php-cgi.exe',resourceType='Unspecified']
    %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='C:\PHP\php-cgi.exe'].environmentVariables.[name='PHPRC',value='C:\PHP\php.ini']"
    %windir%\system32\inetsrv\appcmd set config /section:defaultDocument /+files.[value='index.php']
    

Copy php.ini-production to php.ini in C:\PHP and enable the extensions your site needs. The article Hosting PHP/MySQL websites on a Windows VPS goes as far as the database.


Add modules

IIS is modular. Each feature is added with Install-WindowsFeature.

FeatureUsePowerShell command
Static compressionShrinks static filesInstall-WindowsFeature Web-Stat-Compression
Dynamic compressionCompresses dynamic responsesInstall-WindowsFeature Web-Dyn-Compression
Windows authenticationSingle sign-on with Active DirectoryInstall-WindowsFeature Web-Windows-Auth
Basic authenticationHTTP username and passwordInstall-WindowsFeature Web-Basic-Auth
HTTP loggingWeb request logInstall-WindowsFeature Web-Http-Logging
Request filteringControl of incoming requestsInstall-WindowsFeature Web-Filtering
WebSocketReal-time applicationsInstall-WindowsFeature Web-WebSockets
ASP.NET 4.x.NET Framework applicationsInstall-WindowsFeature Web-Asp-Net45
FTPBuilt-in FTP serverInstall-WindowsFeature Web-Ftp-Server

Example with dynamic compression. Then check the Compression icon of your site in IIS Manager.

Install-WindowsFeature Web-Dyn-Compression

Open ports 80 and 443

For the site to be reachable from the Internet, allow HTTP and HTTPS in the Windows firewall. The client area has no network firewall for VPS: everything is set in Windows.

New-NetFirewallRule -DisplayName "IIS HTTP" -Direction Inbound -Protocol TCP -LocalPort 80 -Action Allow
New-NetFirewallRule -DisplayName "IIS HTTPS" -Direction Inbound -Protocol TCP -LocalPort 443 -Action Allow

The GUI method is in the guide How to open a port in Windows Firewall on a VPS. To move the site to HTTPS with a free certificate, follow Install Let's Encrypt on IIS.


Fix common errors

Error 503, service unavailable

The site's application pool is stopped. In IIS Manager, open Application Pools, select the pool and click Start, or run this PowerShell command.

Start-WebAppPool -Name "example-site"

Error 404, page not found

The site's physical path is wrong, or the page is not in the default documents. Check the path in the site's Basic Settings, and that index.html, index.php or default.aspx is listed in Default Document.

The default IIS page shows instead of your site

The Default Web Site holds port 80. Stop it (right-click, Manage Website › Stop), or give your site a host name in its binding.

The site does not respond from outside

Port 80 or 443 is closed in the Windows firewall. Create the rules from the previous section and check that your domain points to the VPS IP.

The feature is not available during installation

The Windows source files are missing. Mount the Windows Server ISO and point to its sources\sxs folder, replacing D: with the drive letter.

Install-WindowsFeature -name Web-Server -IncludeManagementTools -Source "D:\sources\sxs"

Restart or uninstall IIS

# Restart all IIS services
iisreset
# Restart only the web service
Restart-Service W3SVC
# Uninstall IIS
Uninstall-WindowsFeature -Name Web-Server -IncludeManagementTools

Need help?

Open a ticket from Tickets › Open a Ticket, or from the Contact support tile at the bottom of the VPS page. In the Related Service field, pick the VPS so the team saves time. You can also ask your question on the OuiHeberg Discord.

Was this article helpful?

428 views
Share this article
VPS Windows
Need a Windows VPS?

Windows Server 2025 with the license included, Remote Desktop access and management from the client area.

View plans →
VPS Windows
Need a Windows VPS?

Windows Server 2025 with the license included, Remote Desktop access and management from the client area.

View plans →

Related Articles