Lumina Lighting Design Suite
Projects New design Fixtures Criteria Reference Docs Sign in Create an account

Deploying on IIS

Lumina runs on IIS, but IIS needs different configuration from Apache in two ways that will otherwise stop the application dead.

IIS ignores .htaccess. The rewrite rules that send every URL to the front controller live in public/.htaccess, which Apache reads and IIS does not even look at. The IIS equivalent is public/web.config, which ships with the application.

IIS rewrites REQUEST_URI. After the URL Rewrite module rewrites a request to index.php, the REQUEST_URI server variable reads /index.php; the URL the browser actually asked for is kept in UNENCODED_URL and HTTP_X_ORIGINAL_URL. App\Core\Request reads those, in that order, when it detects an IIS rewrite. An application that trusts REQUEST_URI alone resolves every route to /index.php, so the dashboard loads and every link 404s.

Run php bin/doctor.php before and after deploying. It checks each of the things below and prints what is wrong rather than leaving you to guess.

Prerequisites

| Requirement | Notes | | --- | --- | | PHP 8.1 or newer, non-thread-safe build | IIS runs PHP over FastCGI, which wants the NTS build. doctor.php warns on a ZTS build. | | pdo_sqlite, json, mbstring | Required. The application refuses to boot without them. | | gd | Needed for plan PNGs and false-colour heatmaps. Everything else works without it. | | CGI role feature | Windows feature: Web Server > Application Development > CGI. | | URL Rewrite module | Download from iis.net. See Running without URL Rewrite if you cannot install it. |

1. Register PHP as a FastCGI handler

Once per server, not once per site. In IIS Manager, open the server node, then FastCGI Settings, and add C:\php\php-cgi.exe. Then under the site, open Handler Mappings and add a module mapping:

  • Request path: *.php
  • Module: FastCgiModule
  • Executable: C:\php\php-cgi.exe
  • Name: PHP_via_FastCGI

bin\iis-setup.ps1 checks whether this is already done and prints the equivalent appcmd commands if it is not. Because those commands change server-wide configuration affecting every site on the machine, it only runs them when you ask explicitly:


.\bin\iis-setup.ps1 -AppPool "Lumina" -RegisterPhp

2. Point the site at public, not the project root

This matters. public is the only directory meant to be reachable over HTTP. The project root holds data/lumina.sqlite, your configuration and all the source.


C:\inetpub\lumina\          <- project root, NOT the web root
├── public\                 <- point the IIS site here
├── data\                   <- database, uploads, exports, cache
├── src\  views\  config\   <- application internals

In IIS Manager: Add Website, set the physical path to C:\inetpub\lumina\public, and set the application pool to No Managed Code (Lumina is not a .NET application).

To have the script do it, including the pool:


.\bin\iis-setup.ps1 -AppPool "Lumina" -RegisterPhp -CreateSite -Port 8080

If site policy forces you to point the site at the project root, the web.config in the project root handles it: it forwards requests into public and blocks data, src, config, views, bin, tests, database, resources and plugins. Also add config/local.php so generated links do not carry a /public prefix:


<?php return ['app' => ['base_path' => '/']];

3. Grant the application pool write access

This is the most common IIS failure after routing. SQLite does not only write the database file, it creates lumina.sqlite-wal and lumina.sqlite-shm beside it, so the worker process needs Modify on the data directory, not just on the file. A writable file inside a read-only directory still fails with attempt to write a readonly database.

The identity to grant is the application pool's virtual account, IIS AppPool\<pool name>:


icacls "C:\inetpub\lumina"      /grant "IIS AppPool\Lumina:(OI)(CI)RX" /T
icacls "C:\inetpub\lumina\data" /grant "IIS AppPool\Lumina:(OI)(CI)M"  /T

Or run the script, from an elevated prompt:


.\bin\iis-setup.ps1 -AppPool "Lumina"

It grants those two permissions, verifies the ACL, checks the prerequisites and then runs bin\doctor.php. It only changes ACLs on the project's own directories.

4. Build the database


php bin\migrate.php
php bin\seed.php --demo

Run these as a user who can write to data, then apply the permissions in step 3 afterwards, so the files the CLI creates end up with the app pool's access intact.

5. Verify

Browse to /health. It answers JSON:


{
  "ok": true,
  "sapi": "cgi-fcgi",
  "server": "Microsoft-IIS/10.0",
  "routing": { "base_path": "", "resolved_path": "/health", "url_rewritten": true },
  "data_dir_writable": true
}

Three things to read:

  • resolved_path must be /health. If it reads /index.php, the rewrite happened but the original

URL was not recovered, and no route will work.

  • base_path must match where the app is mounted: empty at a site root, /lumina in a virtual

directory called lumina.

  • data_dir_writable must be true. When it is false /health answers HTTP 503, because nothing

that saves a project can work.

Then load the dashboard and open a tutorial project. If the plan image renders and the results panel populates, routing, static files, the database and GD are all working.

Troubleshooting

| Symptom | Cause | Fix | | --- | --- | --- | | Dashboard loads, every other link returns 404 | URL Rewrite module missing, or public/web.config not deployed | Install the module; confirm the file is present. doctor.php checks both. | | Every URL shows the dashboard | Rewrite rule present but the original URL is not reaching PHP | Confirm the rewrite action is index.php and not a redirect. Check /health resolved_path. | | HTTP 500.19 on every request | A web.config is malformed, or it sets a section IIS locks at server level | doctor.php validates all four files as XML and checks that none uses a locked-by-default section (handlers, modules, serverRuntime, access, authorization). | | HTTP 500.19 only on a nested application | A parent application's web.config is inherited and its rewrite rule or filtering entries are re-declared, producing a duplicate collection key | Already handled: the shipped files begin their rule collection with <clear /> and precede every <add> with a matching <remove>. If you added your own entries, apply the same pattern. | | attempt to write a readonly database | App pool lacks Modify on data | Step 3. Remember it is the directory, not just the file. | | unable to open database file | Same cause, or the database was never built | Step 3, then step 4. | | Blank white page, no error | display_errors off and something fatal early in boot | Look in Event Viewer and the PHP error log. Set LUMINA_DEBUG=1 temporarily. | | CSS and JS 404 | Site points at the project root without the root web.config | Point the site at public, or deploy the root web.config. | | Sign-in never sticks, CSRF failures | PHP cannot write session files | doctor.php checks session.save_path; grant the app pool Modify on it. | | IIS error pages replace the app's own messages | httpErrors existingResponse="PassThrough" missing | Present in the shipped public/web.config; confirm it was not stripped. | | Uploading a large IES file fails silently | upload_max_filesize at or below the app's 4 MB limit | Raise upload_max_filesize and post_max_size in php.ini. | | Links missing the virtual directory prefix | Base path detected wrongly | Check /health base_path; set app.base_path explicitly in config/local.php. |

Running in a virtual directory

No configuration needed. App\Core\Url::basePath() derives the prefix from SCRIPT_NAME, so an app mounted at https://host/lumina generates /lumina/... links and sets the session cookie path to /lumina on its own. Confirm it with base_path in /health.

To override the detected value, set it in config/local.php:


<?php return ['app' => ['base_path' => '/lumina']];

Running without URL Rewrite

If the module cannot be installed, the application can put the front controller in the URL instead. Create config/local.php:


<?php return ['app' => ['front_controller' => 'index.php']];

Links then take the form /index.php/rooms/1, routed through PATH_INFO. Asset URLs stay clean so static files are still served directly by IIS. The cost is uglier URLs and a service worker that no longer controls the whole scope, so offline page caching is reduced. Everything else works.

Compression

public/web.config deliberately does not enable compression. IIS static compression is on by default and already covers CSS and JavaScript. Dynamic compression, which would cover the HTML the application generates, needs the Dynamic Content Compression feature; setting doDynamicCompression="true" when that module is absent is a known cause of HTTP 500.19. doctor.php reports whether the module is installed. If it is, you can add this inside <system.webServer>:


<urlCompression doStaticCompression="true" doDynamicCompression="true" />

Verifying the IIS configuration without IIS

tests\smoke-iis.ps1 runs the application on IIS Express, which is the same core engine, configuration system and URL Rewrite module as full IIS, running as an ordinary user process. It needs no administrator rights, installs nothing, changes no system configuration, and binds only to localhost on a high port. Everything it creates is removed on exit, and it uses the project's web.config files as shipped.


.\tests\smoke-iis.ps1

It asserts that rewritten URLs reach their routes, that the base path is detected correctly at both a site root and a /lumina sub-application, that static files bypass the rewrite and carry their cache header, that the application's own 404 and 419 bodies survive httpErrors, that requestFiltering refuses .sqlite, and that binary PNG responses pass through FastCGI intact. It skips cleanly if IIS Express is not installed.

Security notes

public/web.config sets X-Content-Type-Options, X-Frame-Options and Referrer-Policy, refuses to serve .sqlite, .ies, .ldt, .md and .sql, and caps request bodies at 8 MB. data/web.config clears all handlers and denies every file extension, so the database cannot be downloaded even if the directory ends up inside the web root.

Two things Lumina does not do for you:

  • HTTPS. Bind a certificate and redirect HTTP to it. The session cookie is marked Secure only

when the request arrives over HTTPS, so without TLS the session cookie travels in clear text.

  • Authentication in front of the app. Registration is open by default

(security.allow_registration). On anything reachable beyond a trusted network, set it to false after creating your accounts, or put IIS authentication in front of the site.

  • Getting started — installing, seeding and the first calculation
  • Validation — the test suite, including the request-resolution tests behind this page