Thought I'd post this here for anyone looking to set Flarum up on IIS. This is running on Windows Server 2019 with the latest updates. Ensure that you have the URL Rewrite module for IIS installed (you can download it here).
Next, follow the guide at https://docs.flarum.org/install.html#customizing-paths to move the files up to the root directory. I couldn't get it working using the public
directory, if someone else has, feel free to reply here or mention me in Discord (ProfileSlayer#7877) and I'll try it with their ideas.
Once that's all done, open the default web.config file that IIS generates. Remove everything in this file, and replace it with this:
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="default.aspx" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
</files>
</defaultDocument>
<httpErrors errorMode="Detailed" />
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="/\.git" ignoreCase="false" />
<action type="CustomResponse" url="/" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^auth\.json$" ignoreCase="false" />
<action type="CustomResponse" url="/" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="Imported Rule 3" stopProcessing="true">
<match url="^composer\.(lock|json)$" ignoreCase="false" />
<action type="CustomResponse" url="/" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="Imported Rule 4" stopProcessing="true">
<match url="^config.php$" ignoreCase="false" />
<action type="CustomResponse" url="/" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="Imported Rule 5" stopProcessing="true">
<match url="^flarum$" ignoreCase="false" />
<action type="CustomResponse" url="/" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="Imported Rule 6" stopProcessing="true">
<match url="^storage/(.*)?$" ignoreCase="false" />
<action type="CustomResponse" url="/" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="Imported Rule 7" stopProcessing="true">
<match url="^vendor/(.*)?$" ignoreCase="false" />
<action type="CustomResponse" url="/" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
<rule name="Imported Rule 8" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Once done, restart your site and browse to it. If this does not work, try restarting the server, as the URL Rewrite module might not load after the install until the computer restarts.
If you have any issues with this, you can contact me on Discord (ProfileSlayer#7877), or by starting a new thread in Support and mentioning me in it.
UPDATE 08/04/2020: For a working web.config
file using the public
directory, look at @AntVincent's post here: https://discuss.flarum.org/d/24573-newbie-installation-guide-windows-w-plesk/2