Microsoft IIS
This page is for hosting companies that offer Windows hosting and want to know whether Exponential can be part of it. It answers: what the sources say about IIS, what works differently on Windows, what routing an IIS site must reproduce and what to test. IIS's own management tools are not described here; check Microsoft's documentation for them.
Warning
.htaccess slows down every request. When .htaccess files are enabled (AllowOverride anything but None), let alone
used, Apache looks for them and reads and evaluates them on every request, in every directory of the path, and
page loading times go up drastically (measured). The only real fix is to switch the feature off for
the virtual host: AllowOverride None in the HTTPS virtual host, and the rules in the virtual host's own
configuration as mod_rewrite rules. That is far faster in production speed tests and well worth the time it takes
to optimize a production configuration. Switch over right away: copy the rules of the
example HTTPS virtual host into your virtual host (with the static cache, also
staticcache_offload.conf), set AllowOverride None, run apachectl configtest, reload Apache and
test the site. The same rules for other servers: nginx, LiteSpeed,
Caddy, IIS, Velocity (built in); where virtual host rules go in a control
panel: Plesk, cPanel, DirectAdmin, ISPConfig.
On LiteSpeed or OpenLiteSpeed, the server's own page cache can also answer anonymous visitors and crawlers without PHP: Page caching with LiteSpeed and OpenLiteSpeed.
Contents
- Status
- What Windows changes
- What the kernel knows about IIS
- Routing to reproduce
- Tests before offering it
- Alternatives on Windows machines
- Checklist
Status
| Source | Statement |
|---|---|
README.md, "The traditional options" | Microsoft IIS rewrites with the "URL Rewrite Module (web.config)", for "Windows hosting" |
| Operating system support, Web servers | Microsoft IIS with FastCGI: tier 3; "the URL Rewrite module (web.config); the kernel's request handling has tests for IIS 7 server variables" |
| Operating system support, PHP SAPIs | CGI / FastCGI (cgi-fcgi) is the SAPI for IIS on Windows |
| Operating system support, Windows | use the official PHP 8 builds for Windows (x64, non-thread-safe for FastCGI) with Apache or IIS |
No web.config ships with Exponential. Tier 3 means expected to work, not tested here
(The four tiers).
What Windows changes
From Operating system support, Windows:
pcntlandposixdo not exist on Windows. Asynchronous publishing (bin/php/ezasynchronouspublisher.php) is not available.- Velocity runs its workers as
php-cgisubprocesses on Windows, without copy-on-write memory sharing. Its single-file Windows binaries are built withoutintl, which Exponential's setup requires; run Velocity on Windows through the phar with the official PHP rather than through its binary (expected to work but untested, according to the engine's own platform notes). - The documentation and the shell commands in this help are written for Linux; translate paths and permissions.
- The setup wizard looks for ImageMagick under Windows names too (
convertim.exe,convert.exe, insettings/setup.ini).
Note
For a host, the practical consequence is that a Windows plan behaves like a classic FastCGI plan: no Velocity worker pool with shared memory, no asynchronous publishing. State that in the plan description.
What the kernel knows about IIS
eZSys(inlib/ezutils/classes/ezsys.php) detects IIS's rewritten requests by the server variableIIS_WasUrlRewrittenand then works in virtual host mode, as it does for Apache's.htaccessmode. A site can also force that mode withsite.ini [SiteAccessSettings] ForceVirtualHost=true.- The server-variable fixtures of the kernel's tests include IIS 7 and IIS 7.5 with FastCGI
(
tests/tests/lib/ezutils/server/), in virtual host and non-virtual host mode.
Those fixtures were recorded with old PHP versions; they cover how IIS reports its variables, not a current IIS with PHP 8. Test your own stack.
Routing to reproduce
IIS never reads .htaccess, so exp:setup:htaccess does not protect an IIS site
(Setting up .htaccess and config.php from the console).
Whatever IIS rule set you write must do what .htaccess_root does
(Chapter 8, How a request is served):
| Request | Must go to |
|---|---|
a dot file or dot directory (.git, .env, .htaccess), .well-known excepted | 404 |
an existing .php, .phtml or .phar below the root | 404 |
/api/... | index_rest.php |
/content/treemenu..., /<siteaccess>/content/treemenu... | index_treemenu.php |
a listed asset path (design and extension stylesheets, images, scripts and fonts; var/*/storage/images; image originals; stored PDF exports; public caches; share/icons; the icon themes of extensions, extension/<name>/icons/, images with exactly one extension; package previews; favicon.ico, robots.txt, index.js, sw.js, w3c/p3p.xml) | sent as a file |
| everything else | index.php |
The regular expressions of each line are in .htaccess_root and, for the asset list, in
expVelocity::STATIC_PATHS (kernel/classes/expvelocity.php). The derived nginx block on
nginx with PHP-FPM shows the same list translated once already.
Warning
Keep the order: the dot-file and script rules first, the catch-all last. A catch-all placed first, or an asset rule
that matches .php, can run or leak files.
Tests before offering it
Run the four routing checks of Web servers and engines, then:
- the front page, a content page,
/user/loginand the administration answer; - an uploaded image is shown and an uploaded file downloads through
content/download; - the scheduled task that runs
runcronjobs.phpworks with the CLI PHP (Cron jobs); - the web PHP and the CLI PHP are the same version with the same extensions (Chapter 2, Command line and web PHP);
- 64-bit PHP: 32-bit PHP limits a site to 30 languages (Operating system support).
Alternatives on Windows machines
- Apache with FastCGI PHP on Windows: the shipped
.htaccess_rootapplies directly (copied withphp bin/php/console exp:setup:htaccess --apply). - WSL2 runs the Linux tiers and is the simpler path for development on Windows.
- A Linux virtual machine or container on the Windows host, if the plan can be built that way (Containers, Docker and Podman).
Checklist
- To do: Official PHP 8 x64 non-thread-safe build with FastCGI;
intland the other required extensions present. - To do: A rule set that reproduces the routing table above, tested with the routing checks.
- To do: Plan description states that Velocity's worker pool and asynchronous publishing are not part of it.
- To do: Scheduled tasks for cron jobs in place and tested.
- To do: Tested on staging before sale (tier 3).
Related pages
- Choosing a web server
- Operating systems for hosts
- Operating system support
- Chapter 8: Serving the site
- Setting up .htaccess and config.php from the console
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.