# Install on IIS

Install the mod_pagespeed IIS module on Windows Server: requirements, the signed MSI, IIS Express, the optional optimizer service and the first check.

Canonical URL: https://modpagespeed.com/docs/install-iis/

mod_pagespeed runs on IIS as a native, in-process module: the successor to
IISpeed. Download the signed MSI, run it, `iisreset`, and the module optimizes
every site that has a `pagespeed.config`. The IIS package ships from the 1.15
packaging channel.

## Requirements

- Windows Server 2019 or later (IIS 10 or later)
- 64-bit only
- Visual C++ Redistributable 2022
- The IIS worker process identity needs write access to the cache directory;
  the installer grants it for the default directory

## Install the module

1. Download the [IIS MSI installer](https://modpagespeed.com/download/). Each binary has a `.asc`
   signature next to it.
2. Run it on the Windows Server host. The installer registers the module in
   IIS as a native HTTP module and creates the default cache directory at
   `%ProgramData%\We-Amp\IISWebSpeed\Cache`.
3. Run `iisreset`.

The module reads `pagespeed.config`: a server-level file at
`%ProgramData%\We-Amp\PageSpeed\pagespeed.config` and, optionally, one in each
site's physical root. The minimal file is two lines:

```text
pagespeed on
pagespeed FileCachePath %ProgramData%\We-Amp\IISWebSpeed\Cache
```

[IIS configuration](https://modpagespeed.com/docs/iis-configuration/) documents the file format, the
lookup order and path matching.

### Coming from IISpeed

If IISpeed is installed on this host, **uninstall it before running the MSI**.
The two modules register the same handler in IIS and cannot coexist. Open
_Apps & features_ (or _Programs and Features_), remove "IISpeed", run
`iisreset`, then run the installer.
[Migrate from IISpeed](https://modpagespeed.com/docs/migrate-from-iispeed/) walks through the whole
move, configuration and cache included.

### The optimizer service

The installer also installs the optimizer worker, as the Windows service
`WeAmpPageSpeedOptimizer` under its own virtual account, and leaves it
**disabled**: until you turn it on, the module behaves exactly as it does
without it. Turned on and pointed at with the `DaemonSocketPath` and
`DaemonVolumePath` directives, it takes over in-place optimization: the module
records each eligible resource, the optimizer builds optimized variants, and
the module serves the variant that fits each client. An upgrade or repair with
the installer keeps a service you turned on running and keeps the cache size
you chose (`OPTIMIZERCACHESIZE`, 1 GiB by default).

### IIS Express

For local development with IIS Express, add the module to
`applicationhost.config` in `%userprofile%\Documents\IISExpress\config\`:

1. Copy the module DLL to a known location
2. Add the module registration under `<globalModules>` and `<modules>`
3. Restart IIS Express

## Verify it works

On IIS the module emits `X-Page-Speed`, the same header as the nginx module.
Check for it with PowerShell:

```powershell
(Invoke-WebRequest http://localhost/ -Method Head).Headers["X-Page-Speed"]
```

Then open `/pagespeed_global_admin` on the server itself.
[Is it working?](https://modpagespeed.com/docs/is-it-working/) has the other checks.

## Next steps

- [IIS configuration](https://modpagespeed.com/docs/iis-configuration/): `pagespeed.config`, lookup
  order, path matching and IIS tuning
- [Filter selection](https://modpagespeed.com/docs/filter-selection/): choosing and tuning filters
- [Admin console](https://modpagespeed.com/docs/admin-console/): restricting the admin pages
- [Migrate from IISpeed](https://modpagespeed.com/docs/migrate-from-iispeed/)

## Frequently asked questions

**Can the IIS module and IISpeed run on the same host?**

No. Both register the same handler in IIS and one or both fail at site startup. Uninstall IISpeed, run `iisreset`, then run the MSI. Your IISpeed configuration files keep working.

**Does the IIS installer include the optimizer worker?**

Yes, as the Windows service `WeAmpPageSpeedOptimizer`, installed disabled. Until you turn it on and point the module at it with `DaemonSocketPath` and `DaemonVolumePath`, the module optimizes on its own exactly as before.
