### How to install Flarum on Windows Plesk (IIS) 😄
As a hobbyist sysadmin, compared to most of the folks on here, I am relatively inexperienced. With support from @katos and @[deleted] (big thank you again chaps), I was able to overcome a couple of 'gotchas' getting Flarum working on a Windows IIS setup.
This tutorial assumes you have:
Step One: Install the Flarum Repository
- Click Websites & Domains and find your domain
- Click GIT
- Remote Git repository field enter: https://github.com/flarum/flarum.git
- Click OK
Step Two: Compile using PHP Composer
- Head back to Website & Domains and find your domain
- Click PHP Composer
- Click Scan (this may take a couple of minutes to complete)
- Click Update (this may take a couple of minutes to complete)
- Click Install (this may take a couple of minutes to complete)
Step Three: Change Domain Document Root
Note: This is a really important step as it will prevent exposing private files on your server
- Head back to Website & Domains and find your domain
- Click Hosting & DNS
- Click Hosting Settings
- Change Document root: from httpdocs to httpdocs\public
- Click Apply
Step Four: Create web.config
- Head to your domains httpdocs\public folder
- Create a new file (add the below code)
- Save file as: web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="Index.php" />
</files>
</defaultDocument>
<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>
Step Five: Create Database
- Click Databases
- Click your domain
- Click Add Database button
- Enter preferred database name, username and password
- Be sure to select your domain from the 'Related Site' drop down
- Click OK
Step Six: Reset your domain server pool
- Head back to Website & Domains and find your domain
- Click Hosting & DNS
- Click Dedicated IIS Application Pool For Website
- Click Recycle button
Step Seven: Done
- Browse to your domain www.domain.com
- Populate with the database details
- Pick your admin name and password
- Done & enjoy
Hope that helps 🙂
Ant