QGIS Server

Mappin needs a WMS server for rendering map images / tiles.

We recommend using QGIS Server which will be installed in this section.

Mappin is also capable of obtaining WMS images / tiles from GeoServer. If you intend to use an existing GeoServer installation instead of QGIS Server then skip the rest of this section.

Obtaining Software

  1. Download Apache 2.4.x Win64 from the link below:

    https://www.apachelounge.com/download/

  1. Also download vc_redist_x64 from the same page
  2. Also download mod_fcgid-2.3.10-win64-VS16.zip from the same page

Installing Apache

  1. Run the vc_redist_x64 installer.
  2. Extract the Apache24 folder from the zip file (httpd-2.4.41-win64-VS16.zip) to the root of the C: drive so you now have a folder at C:\Apache24
  3. Locate mod_fcgid.so from mod_fcgid-2.3.10-win64-VS16.zip and extract it to C:\Apache24\modules

Next we’ll configure Apache to work with QGIS Server.

  1. Edit C:\Apache24\conf\httpd.conf
  • Change Listen 80 to Listen 8080

    This will cause Apache to listen on port 8080 (port 80 will be used by Mappin).

  • Change ErrorLog "logs/error.log" to ErrorLog "|bin/rotatelogs.exe -l logs/error.%Y.%m.%d.log 86400"

  • Change CustomLog "logs/access.log" common to CustomLog "|bin/rotatelogs.exe -l logs/access.%Y.%m.%d.log 86400" common

  • Add the following line at the end of the file:

    Include conf/extra/qgis.conf

  1. Download qgis.conf and save it to C:\Apache24\conf\extra\qgis.conf
  • To maximise performance, we recommend setting FcgidMaxProcesses within qgis.conf (last line) to one less than the number of physical processor cores on the server.
  1. Next create (and start) the Apache service:
  • Open a command prompt as Administrator

  • Run these commands:

    cd C:\Apache24\bin
    httpd.exe -k install
    sc start Apache2.4
    

Apache has now been configured. Next we need to install QGIS Server.

Warning

QGIS Server writes verbose logs (under C:\Apache24\logs).

To ensure that logs do not fill up your disk, we recommend you:

  • Enable filesystem-level compression (the Compress contents to save disk space option) on this folder
  • Run the included script rotate-qgis-server-logs.bat as a nightly scheduled task

The script mentioned in the latter point is located at %MAPPIN_HOME%\bin where %MAPPIN_HOME% is your Mappin installation directory. It stops Apache, renames the day’s QGIS Server log based on the date and removes any log files older than one year. Adjust the script according to your needs.

Installing QGIS Server

We’ll use the OSGeo4W installer to install QGIS Server.

  1. Download the OSGeo4W Network Installer (64 bit) using the link below:

    https://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe

  1. Run it, choosing:
  • Advanced install
  • Install from internet
  • Default root directory (C:\OSGeo4W64)
  • Install for all users
  • You may need to fiddle with proxy server settings if you’re on a restrictive network
  1. Select these packages:
  • web/qgis-ltr-server (latest version)
  1. Click Next, opting to download and install any suggested dependencies

QGIS server should now be installed and the OSGeo4W installer can be used to upgrade it (and its dependencies) in the future.

Offline installation of QGIS Server

You’ll notice that QGIS Server uses an online installer, installing from the internet.

The installer can also be used to download selected packages and their dependencies from the internet and store them in its Local Package Directory. If you need to perform an offline installation, we recommend using the Download Without Installing option to download all files you need to the Local Package Directory. It’s worth setting the Local Package Directory to something sensible like C:\OSGeo4WPackages so it can be easily transferred to another computer. When performing an offline install, select the Install from Local Directory option during installation.