Install IIS (Web Server)
This guide explains how to install and configure IIS (Internet Information Services) on your Windows VPS.
What is IIS?β
IIS is Microsoft's web server, built into Windows Server. It allows you to host websites, ASP.NET applications, PHP, and more.
Installing IISβ
Via PowerShell (recommended)β
# Install IIS with basic features
Install-WindowsFeature -Name Web-Server -IncludeManagementTools
# Install with all common features
Install-WindowsFeature -Name Web-Server, Web-Common-Http, Web-Static-Content, Web-Default-Doc, Web-Dir-Browsing, Web-Http-Errors, Web-Http-Logging, Web-Stat-Compression, Web-Filtering, Web-Mgmt-Console -IncludeManagementTools
Via GUIβ
- Open Server Manager
- Click Manage > Add Roles and Features
- Next until Server Roles
- Check Web Server (IIS)
- Add required features
- Next and Install
Verify Installationβ
- Open a browser on the VPS
- Go to
http://localhost - You should see the IIS welcome page
From outside, access http://YOUR_IP
IIS Managerβ
Open IIS Manager:
Win + R>inetmgr
Or search for "Internet Information Services (IIS) Manager"
Create a Websiteβ
Via IIS Managerβ
- In the left panel, right-click Sites
- Click Add Website...
- Configure:
- Site name: MySite
- Physical path:
C:\inetpub\wwwroot\mysite - Binding:
- Type: http
- Port: 80
- Host name: mysite.example.com (optional)
- Click OK
Via PowerShellβ
# Create the folder
New-Item -Path "C:\inetpub\wwwroot\mysite" -ItemType Directory
# Create the site
New-IISSite -Name "MySite" -PhysicalPath "C:\inetpub\wwwroot\mysite" -BindingInformation "*:80:mysite.example.com"
File Structureβ
Place your files in the site folder:
C:\inetpub\wwwroot\mysite\
βββ index.html
βββ css\
βββ js\
βββ images\
Configure Multiple Sitesβ
Method 1: By Domain Name (recommended)β
# Site 1
New-IISSite -Name "Site1" -PhysicalPath "C:\inetpub\wwwroot\site1" -BindingInformation "*:80:site1.example.com"
# Site 2
New-IISSite -Name "Site2" -PhysicalPath "C:\inetpub\wwwroot\site2" -BindingInformation "*:80:site2.example.com"
Method 2: By Different Portβ
# Site on port 8080
New-IISSite -Name "Site2" -PhysicalPath "C:\inetpub\wwwroot\site2" -BindingInformation "*:8080:"
Install PHPβ
Download PHPβ
- Download PHP from windows.php.net
- Choose the Non Thread Safe (NTS) x64 version
- Extract to
C:\php
Configure PHPβ
# Rename the configuration file
Copy-Item "C:\php\php.ini-production" "C:\php\php.ini"
Edit C:\php\php.ini:
extension_dir = "C:\php\ext"
cgi.fix_pathinfo=0
; Enable common extensions
extension=curl
extension=gd
extension=mbstring
extension=mysqli
extension=openssl
extension=pdo_mysql
Install CGI for IISβ
Install-WindowsFeature -Name Web-CGI
Configure PHP Handlerβ
- Open IIS Manager
- Select your server
- Double-click Handler Mappings
- Click Add Module Mapping...
- Request path:
*.php - Module:
FastCgiModule - Executable:
C:\php\php-cgi.exe - Name:
PHP
- Request path:
- Click OK
Test PHPβ
Create C:\inetpub\wwwroot\info.php:
<?php
phpinfo();
?>
Access http://YOUR_IP/info.php
Delete info.php after testing!
Configure HTTPS with SSLβ
Generate a Self-Signed Certificate (testing)β
New-SelfSignedCertificate -DnsName "mysite.example.com" -CertStoreLocation "cert:\LocalMachine\My"
Add HTTPS Bindingβ
- IIS Manager > Sites > Your site
- Right-click > Edit Bindings...
- Add...
- Type: https
- Port: 443
- SSL certificate: Select your certificate
- OK
With Let's Encrypt (production)β
Use win-acme:
# Download and extract win-acme
# Then run
.\wacs.exe
Follow the instructions to generate a free certificate.
Useful IIS Commandsβ
# Start/Stop IIS
iisreset /start
iisreset /stop
iisreset /restart
# Start/Stop a site
Start-IISSite -Name "MySite"
Stop-IISSite -Name "MySite"
# List sites
Get-IISSite
# Delete a site
Remove-IISSite -Name "MySite" -Confirm:$false
IIS Logsβ
Logs are located in:
C:\inetpub\logs\LogFiles\W3SVC[SITE_ID]\
To change the location:
- IIS Manager > Your site
- Double-click Logging
- Modify the Directory
Application Poolsβ
Each site uses an application pool to isolate processes.
# Create a pool
New-WebAppPool -Name "MyPool"
# Assign to a site
Set-ItemProperty "IIS:\Sites\MySite" -Name applicationPool -Value "MyPool"
# Recycle a pool (clean restart)
Restart-WebAppPool -Name "MyPool"
Troubleshootingβ
500 Error Pageβ
- Check logs in
C:\inetpub\logs\LogFiles\ - Enable detailed errors:
Set-WebConfigurationProperty -Filter "system.webServer/httpErrors" -Name "errorMode" -Value "Detailed"
Permissionsβ
# Grant permissions to the application pool
icacls "C:\inetpub\wwwroot\mysite" /grant "IIS AppPool\MyPool:(OI)(CI)F"
For .NET applications, use the application pool with the appropriate CLR version (.NET CLR v4.0).