How to Disable IIS Service on Windows Server 2008 to Resolve Port 80 Conflicts with Apache


4 views

When both IIS and Apache try to bind to port 80 (the default HTTP port), you'll encounter errors like:

(OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted
: AH00072: make_sock: could not bind to address [::]:80

This occurs because Windows Server 2008 installs IIS by default as part of its "Web Server" role.

First, verify if IIS is actually running with this PowerShell command:

Get-Service -Name W3SVC

Or through command prompt:

sc query W3SVC

If the state shows "RUNNING", IIS is actively using port 80.

The correct service name for IIS is "World Wide Web Publishing Service" (W3SVC). Here's how to disable it:

Method 1: Using Services Console

1. Press Win+R, type "services.msc"
2. Locate "World Wide Web Publishing Service"
3. Right-click → Properties
4. Set Startup type to "Disabled"
5. Click "Stop" to immediately terminate the service

Method 2: Command Line Approach

To disable via command prompt (admin rights required):

sc config W3SVC start= disabled
net stop W3SVC /y

Method 3: PowerShell Alternative

Set-Service -Name W3SVC -StartupType Disabled
Stop-Service -Name W3SVC -Force

After disabling, ensure IIS isn't listening on port 80:

netstat -ano | findstr :80

You should only see Apache's process in the output now.

If you prefer to keep IIS installed but want Apache to use port 80:

1. Edit httpd.conf in Apache:
   Listen 80
   ServerName localhost:80

2. Configure IIS to use a different port:
   - Open IIS Manager
   - Select "Sites" → "Default Web Site"
   - Click "Bindings" and change port 80 to 8080

Before disabling IIS completely:

  • Check if any internal applications rely on IIS
  • Verify that Windows Server Update Services (WSUS) isn't using IIS
  • Consider that some Microsoft features (like SharePoint) require IIS

If you're certain IIS isn't needed, you can completely remove the Web Server role:

ServerManagerCmd.exe -remove Web-Server

If you're running both Apache and IIS on Windows Server 2008, you've likely encountered the inevitable battle for port 80. Here's how I permanently resolved this in my production environment:

Before making changes, verify if IIS is actually running:

# PowerShell command to check IIS status
Get-Service -Name W3SVC

# Expected output if running:
# Status   Name               DisplayName
# ------   ----               -----------
# Running  W3SVC              World Wide Web Publishing Service

Unlike regular services, IIS requires a specific approach:

# Method 1: Using Server Manager GUI
1. Open Server Manager
2. Navigate to Roles → Web Server (IIS)
3. Right-click and select Remove Role
4. Follow the wizard but DON'T select full removal

# Method 2: Via PowerShell
Uninstall-WindowsFeature -Name Web-Server -Restart:$false

If you prefer to keep IIS installed but disabled:

# Disable the core IIS services
Set-Service -Name W3SVC -StartupType Disabled
Set-Service -Name WAS -StartupType Disabled

# Optional: Stop immediately if running
Stop-Service -Name W3SVC -Force
Stop-Service -Name WAS -Force

After making changes, confirm port 80 is free:

netstat -ano | findstr :80

# Should return nothing if successful
# For thorough verification:
Test-NetConnection -ComputerName localhost -Port 80

If you encounter problems:

  • Check for dependent services: HTTP.sys might still hold the port
  • Verify no other web platforms (like SQL Server Reporting Services) are using port 80
  • Consider checking the HTTP namespace reservation: netsh http show urlacl

After freeing port 80, ensure Apache is properly configured:

# Typical httpd.conf directive
Listen 80
ServerName localhost:80

# For virtual hosts:
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "C:/Apache/htdocs"
    ServerName localhost
</VirtualHost>