Exponential runs on Windows with IIS, the non-thread-safe build of PHP for Windows over FastCGI, and the IIS URL Rewrite module. The kernel ships doc/eng-us/examples/web-servers/web.config, which carries everything for the installation root: the PHP handler, the rewrite rules of .htaccess_root, request filtering and the security headers.
Note: The shipped web.config was checked as well-formed XML. It was not run on an IIS server by the project, so test it on a staging site first.
Install it
- Install IIS with the CGI feature (it brings FastCGI), the URL Rewrite 2.1 module, and PHP for Windows (NTS, x64). Register php-cgi.exe under FastCGI Settings and set memory_limit, upload_max_filesize and post_max_size in its php.ini.
- Point the site's physical path at the installation root, where index.php is.
- Copy the file there as web.config and adjust scriptProcessor to your php-cgi.exe.
- Give the application pool's identity write access to var/, and read access to the rest.
- Bind HTTPS with your certificate, and add an HTTP-to-HTTPS redirect on the port 80 binding.
How the rules map
IIS URL Rewrite matches the path without its leading slash, as Apache does in .htaccess, so the patterns are those of .htaccess_root unchanged. The rule exp-front-controller sends everything else to index.php; an outbound rule adds the sandbox policy to SVG responses.
Request filtering
Request filtering answers 404 before any rewrite rule runs, as defense in depth. hiddenSegments lists only names no page can have (.git, .env, .htaccess, composer.json, composer.lock), because it matches a segment anywhere in a path. The fileExtensions list refuses .ini, .db, .sqlite, .log, .phtml and .phar everywhere.
Headers
customHeaders adds the kernel's default security headers to every response. Keep the values equal to site.ini [HTTPHeaderSettings] SecurityHeaders[], or remove the header from one of the two, so a page never carries two different values.
Good to know
- IIS never reads .htaccess. config.php is put into place with exp:setup:config, as on every server.
- WebDAV is not routed. To serve it, add a rule for index_webdav.php before the catch-all and keep IIS's own WebDAV module off for it.
- Windows PHP has no pcntl and posix, so asynchronous publishing is not available. See Install on Windows.