Skip to content

[Deprecated] How to set up a local IIS web server for the Keyman web pages

Darcy Wong edited this page Feb 16, 2024 · 2 revisions

Deprecated

This document is now outdated as our main websites have migrated from IIS to Apache (Docker).

Refer to https://github.com/keymanapp/keyman/blob/master/docs/websites/README.md for setting up local dev environment with Docker.


Some IIS rewrite notes during this transition period.

Reference: https://github.com/keymanapp/keyman.com/issues/337#issuecomment-1336339387

  1. Install Microsoft Application Request Routing

  2. From IIS Manager --> Application Request Routing Cache --> Server Proxy Settings... --> Enable proxy --> Apply

  3. From IIS Manager --> Remove .local sites that are now running with Docker

  4. Edit \windows\system32\inetsrv\config\applicationHost.config, add following section under <system.webServer> (edit <rewrite> if it already exists). Add additional sites and port numbers as needed:

        <rewrite>
            <globalRules>
                <rule name="help.keyman-local.com forward proxy" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^help\.keyman-local\.com|help\.keyman\.com\.local$" />
                    </conditions>
                    <action type="Rewrite" url="http://localhost:8055/{R:0}" />
                </rule>
                <rule name="s.keyman.com proxy" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^s\.keyman-local\.com|s\.keyman\.com\.local$" />
                    </conditions>
                    <action type="Rewrite" url="http://localhost:8054/{R:0}" />
                </rule>
                <rule name="web.keyman-local.com proxy" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^web\.keyman-local\.com|keymanweb\.com\.local$" />
                    </conditions>
                    <action type="Rewrite" url="http://localhost:8057/{R:0}" />
                </rule>
            </globalRules>
        </rewrite>

The following explains how to set up a web server with PHP installed in order to host the Keyman web pages locally.

On Windows 10:

  1. Open "Turn Windows Features on or off"

  2. Select Internet Information Services (IIS) to install it. (Defaults are okay.) Click OK.

    Wait for it to install and then click Close.

  3. Start IIS Manager (run as Administrator).

  4. Click "Get New Web Platform Components" on the right hand side.

    This opens a website from which the "Microsoft Web Platform Installer" can be downloaded. Run that installer (wpilauncher.exe).

  5. Run the Microsoft Web Platform Installer (as Administrator).

  6. Search for PHP 7.4.1.

    Click the Add button next to PHP 7.4.1 (x64), and then click Install below.

    Click Finish and exit.

  7. In IIS's left panel, right-click Default Web Site, and click Add Virtual Directory.

    Alias: keymanweb.

    Physical path: C:\...\keyman\apps\keymanweb

  8. Add the following sites in IIS by right-clicking Sites and then clicking Add Website:

    • keyman.com.local
    • s.keyman.com.local
    • help.keyman.com.local
    • keymanweb.com.local

    For each of the above, set the Alias and Host name as above and the Physical path to the folder where you have cloned the corresponding site code.

  9. Edit c:\windows\System32\drivers\etc\hosts (using a text editor running as Administrator). Add the following line:

    127.0.0.1 keyman.com.local s.keyman.com.local keymanweb.com.local help.keyman.com.local api.keyman.com.local

  10. Go to https://getcomposer.org/download/ to download and install Composer, the PHP dependency management system used by most of our sites.

  11. For each of the sites above aside from s.keyman.com.local, to go the site's corresponding repo root and run composer install.

Browse to http://localhost/keymanweb/

Then open your web browser, navigate to http://localhost/_____/index.php?id=1

Note: From other machines on the local network you could use the IP address of your machine instead of 'localhost'. You may also have to adjust firewall settings for other machines to be able to access the site.

More detail on installing PHP/web servers can be found pretty much everywhere online. Be careful about opening up firewalls on computers that may visit public networks such as open wifi hotspots.

Certificates for HTTPS

See https://github.com/keymanapp/keyman/blob/master/resources/devbox/iis-https/README.md

Clone this wiki locally