How do I install and configure IIS on Windows for Matomo?
Now that we’ve setup MySQL and PHP on Windows for Matomo we can finally setup IIS to act as the Matomo web server using the guide below.
Install IIS
This differs across Operating systems. Please search for IIS installation online if the below guide does not match your OS.
-
First of all, select the Control Panel.
-
In the Programs section, select Turn Windows Features on or off.
-
You might encounter the following screen:
-
Now, simply click on the features that are checked on the following screens and then hit the OK button.
-
A progress bar will appear.
-
Once the installation is over, to confirm it, simply type the following URL into your browser: http://localhost.
If installation is successful, then you will see a IIS page.
Congratulations!
Configure IIS to treat index.php as the default content page
-
To open IIS Manager, click Start, type iis in the Search Programs and Files box, and then press Enter.
-
Select and open Default Document at the server level:
-
Click Add… and enter index.php:
Configure IIS to handle PHP files
-
Click Handler mappings:
-
Click Add Module Mapping from the right hand menu:
-
Configure the dialog as shown below:
-
Click OK.
-
A prompt will ask if you want to add this as a fastCGI application. Select no.
Configure IIS bindings
-
Open IIS Manager and select your website that contains Matomo.
-
Then select Bindings …
-
Select Add …
-
Enter the domain for your Matomo, click OK.
-
Confirm the binding has been added.
-
Update your DNS entries to point towards the server.
Configure FastCGI timeout for IIS
Next we need to change the configured activityTimeout in the IIS Manager under the server/IIS/FastCGI Settings/Edit to a higher value than what is set to by default.
Depending on the amount of data the archiver will need to process, it may be necessary to increase the value to a very high number (such as 36000 or more – which is 10 hours) to allow the archiver to complete.
Not setting this to a higher value will result in the Matomo archiver not being able to process any reports.
Once this has been changed, you will need to restart the server for these changes to take effect.
You can also follow the steps below to change the Activity Timeout setting for example in IIS 7.5:
-
Open InetMgr (Press the windows key+R then type Inetmgr and hit enter)
-
Use the filter to search for FastCGI Settings
-
Click on Edit… and proceed to change the Activity Timeout value to 36000 or more.
-
Once the value has been changed, you will need to restart the server in order for the changes to take effect.
Please note: the steps to change this value may be different depending on which version of IIS you have installed.
Disable Request Filtering (for Heatmap & Session Recording plugin)
When using Heatmaps & Session Recording, in Settings > Diagnostics > System Check, you may encounter the following warning message:
Requesting 'https://analytics.example.com/plugins/HeatmapSessionRecording/configs.php?idsite=4&trackerid=5lX6EM&url=http%3A%2F%2Ftest.test%2F' resulted in an SSL error.
Maybe you are using a self signed certificate?
Please open the URL manually in a browser to see if the response contains 'Piwik.HeatmapSessionRecording'.
If not, you might need to modify your server configuration as this file needs to be accessible via a browser from the Internet or Intranet.
The issue is that requesting the URL path /plugins/HeatmapSessionRecording/configs.php results in a 404 error. This is likely caused by the feature “Request Filtering”, a security feature that was introduced in Internet Information Services (IIS) 7.0.
To make Heatmaps & Session Recording work as expected, you can disable Request Filtering by following the steps below. You can also learn more about Request Filtering in the IIS documentation.
To disable Request Filtering:
-
On the taskbar, click Start, point to Administrative Tools, and then click Server Manager.
-
In the Server Manager hierarchy pane, expand Roles, and then click Web Server (IIS).
-
In the Web Server (IIS) pane, scroll to the Role Services section, and then click Add Role Services.
-
On the Select Role Services page of the Add Role Services Wizard:
→ un-select Request Filtering,\
and then click Next. -
On the Results page, click Close.
Now that Request Filtering is disabled, in Settings > Diagnostics > System Check you should not see the warning anymore.
Verify the web server is responding
Create a file in c:\Inetpub\wwwroot called phpinfo.php In order to quickly verify that your web server is correctly configured to execute PHP scripts, you could create a file which contains:
<?php\
phpinfo();
When you visit this page at http://127.0.0.1/phpinfo.php you see a similar phpinfo output:
Congratulations, your web server is running and correctly configured to handle PHP7 requests.
Copy Matomo to the webroot for IIS
Now that we have IIS setup we need to copy the Matomo files to the C:\Inetpub\wwwroot"
folder
Download the latest release Matomo 5.2.1 from here:
Once Matomo has been downloaded, unzip the file and copy the contents of the matomo
folder to the C:\Inetpub\wwwroot
folder
Verify the Matomo console command is working
Next, open a command, and run the Matomo console to check it is working as expected:
php "c:\Inetpub\wwwroot\console"
The console command output will look like this:
Continue with the Matomo Installation
Once You have MySQL, PHP and IIS setup on Windows you can continue with the Matomo 5-minute installation.
Once the Matomo 5-minute installation is complete, Matomo should now be successfully setup and running on your Windows server.
Now that Matomo is running, we can continue to setup a scheduled task for archiving reports in Matomo.
If you haven’t already setup MySQL for Windows you can follow our guide here: How do I install and configure MySQL on Windows for Matomo?
You will also need to have PHP for Windows installed and setup according to our guide here: How do I install and configure PHP on Windows for Matomo?