Installing QGIS Server in Windows 10

This tutorial or walkthrough is curated for those people who might want to install QGIS Server in their machines containing Windows 10 operating system or those that might be encountering challenges in installing the same. It consist of a step-by-step procedure with explanations that the usual setups and installation wizards might have or the information provided is little to make one understand.

QGIS Server is a an open source Geographic Information Systems (GIS) server that leverages on the Open Geospatial Consortium (OGC)’s services which include:

  1. Web Map Service (WMS)
  2. Web Feature Service (WFS)
  3. Web Coverage Service (WCS)

The above services have been well described in a previous post here. QGIS Server can be deployed in both Windows 10 and the steps below show how one can deploy/install the robust GIS server. A standard QGIS Server does not have specifications per-se and for such one can make reference to GIS StackExchange

Navigate to QGIS Installers web page at Download QGIS page using your browser. The web page looks as shown below.

Click on the OsGeo4w Network Installer (64-bit) for 64-bit computers and OsGeo4w Network Installer (32-bit) for 32-bit computers and this starts a download step.

Similarly, navigate using your browser to XAMPP Download Page that appears as below.

Click on the Download button. Note that there are only 64-bit downloads in the page above and this will also start a download process in the browser. Once the downloads are complete, the files appear in the file systam as shown below.

In this procedure, we will start with installing QGIS Server using the network installer. Double click the osgeo4w setup or right mouse click and select open option. This makes the installer wizard to appear as shown below.

Ensure the Advanced Install radio button is the selected one as above. This option grants the liberty to install individual Desktop and Server packages unlike the other two and in this case we only want to install the QGIS Server. Click Next button to proceed to the next wizard page shown below.

  

The option Install from Internet is for initial download (first run) which instructs the setup to download files from the internet into the computer and this is the step that we shall use. The option Download Without Installing just download files from the internet and does not install. The third option, Install from Local Directory is used when one has downloaded the files into a folder in local computer. (One needs to know there the files have been downloaded) Click Next  to proceed.

The Root Directory above is the ‘installation folder’ that hosts the installed/extracted files and by default the path is as shown in the white text input above as C:\OSGeo4W64 . One can change by clicking the Browse… button though we will leave it as is. For the users section, All Users ensures that all users in the computer can access the OSGeo4w software while for the Just Me option only the current user (one who is installing and must have administrative rights) has access to those files. Click Next to proceed.

The Local Package Directory is the folder in which the contents of QGIS Server and other supporting files (not installed files) downloaded from the internet will be saved and the Start menu name is the name that will appear in Windows Startup Programs as shortcut. Just lke the previous one can click on the Browse… button to select a custom location. When Browse… button is clicked, the following Windows Browse window appears as shown below.

Once you select the preferred folder, click OK button to close. Below page shows a custom location that has been selected.

Once the custom location is selected, click Next to proceed.

In the above page, the way with which the setup connects to the internet must be configured. By default the Direct Connection option is selected. Use IE5 Settings uses Internet Explorer 5 connectionconfiguration while the Use HTTP/FTP Proxy option is used where the network is behind a proxy. In this the default option is left as is. Click Next to proceed.

There are various download site URLs that are listed above and the setup downloads from the user selected option. Select one of the links to activate the Next button or one can also add a custom URL in the User URL text field and click Add button. When the existing URL is clicked it appears as shown below.

 

Once the URL has been selected or a custom URL has been input, the Next button is activated and can be clicked to continue.

There are many packages that can be downloaded and installed by the osgeo4W installer and they are listed in the above page. Since the installation is for QGIS Server, click the + sign next wo Web option and it collapses with 5 more options. Click on the Skip option for qgis-server and a version number will appear just as shown above. The rest of the options can be left as is. Click Next button to continue.

The page shown above displays a list of the packages and libraries that will be installed. Click Next button to proceed.

This page initializes a download of the packages from the URL that was selected earlier. Some libraries are shipped with End User License Agreements (EULA) that one must accept to continue as some also have licenses for free, non-commercial usage and et cetera. After accepting these licenses and agreements, click Next to continue.

A page with active progress bars (in green above) appears and the percentage download progress is also displayed at the title bar above. The first progress bar shows the download progress for the individual package being downloaded, the second shows the overall/total download progress of the packages and the third progress bar shown the computer disk size. This process should not be interrupted and it is dependent on internet speed/network latency once complete i.e. at 100% then the following final page is shown. If there are errors in download, then the download failure will be shown in a rather similar fashion. Click Finish button to close the installer wizard. 

 

Next procedure entails installation of XAMPP. XAMPP is a free and open source web application server that is cross-platform and has been developed by Apache Foundation. It consists of Apache Web Server, MariaDB database and Hypertext Preprocessor (PHP) and Perl interpreters among othets. Let’s begin by double clicking the xampp setup that was downloaded in the beginning steps.

The setup wizard appears as shown above. Click Next button to proceed.

Above are the packages that are shipped with the XAMPP setup. For the purposes of QGIS Server, only the Server > Apache is required therefore the rest can be unchecked to match the case above. A breakdown of the main components required for the QGIS Server installation include:

  1. Apache Server – The role of  this server in QGIS Server is to provide Hypertext Transfer Protocol (HTTP) in which the OGC services mentioned in the beginning of this post are dependent on. QGIS Server uses FastCGI protocol that is an Apache module therefore the importance of the server is realized in this.
  2. PHP – This comes tightly coupled with the web server therefore cannot be unchecked (at least for version 8.0.3)

Click Next button to continue.

The page shown the default path/folder in which the selected components of XAMPP will be installed in. By default it installs in the Windows’ system/OS drive i.e. C:\Xampp and to change this click on the icon on the right side of the path field and it opens the file system for one to select their preferred installation location. Once the preferred location is clicked, click Next button to continue.

Select the preferred language and click Next to proceed.

On this page, some info on the developers of the installer, if not interested in the info, uncheck the checkbox as above and by click Next button to continue.

Click Next button to begin installation of the components.

A progress wizard similar to those in osgeo4W installer appears in the middle of the page below the XAMPP welcome image. The installation should not take a lot of time but also depended on hardware specifications. Once the installation is complete, Next button is activated and can be clicked to proceed.

This informs that the installation has completed successfully. Ensure the checkbox in the page is checks so that it can open the XAMPP control panel. Click Next button to proceed.

The control panel assists in enabling and disabling the services listed. In the case above, only Apache has been installed therefore, it is the only active row while the rest are inactive (greyed out). Click on the Start button in the first row for Apache.

The control panel shown above indicates that Apache Server module is running and is assigned the Process Identification (PID) 7036, 150028 and running on port(s) 80, 443. Click on the Admin button.

A browser page is opened with the URL pointing to the localhost and it confirms that apache in deed is running. 

Once both XAMPP and QGIS Server are installed, we have to configure some settings in the default apache configuration file. By default, the apache configuration file (for XAMPP 3.0.8) is located in C:/xampp/apache/conf/httpd.conf

The file shown above can be opened with a text editor like notepad or any other editor that is installed and contains settings/configurations for the apache server and one has to be careful not to remove or insert wrong information in the file as it may affect the working of apache server.

The apache configuration file appears as shown above in Notepad++ text editor.

Let’s confirm hat the file qgis_mapserv.fcgi exists in the bin folder of the qgis app in folder shown above. If it exists then we

Edit the line shown above for the Script Alias (highlighted in grey) to point to the bin directory shown in the previous diagram. Note that the original line has been commented by adding a # before it.

Similarly add a directory directive as shown above (in grey) to point to the same bin folder as the previous and inside it a number of statements that allows apache server permissions to access the folder and also execute the relevant scripts. 

Add an .exe handler in order to enable server to execute the QGIS Server executable files.

Finally, add the following lines as shown above and ensure that the paths in the lines shown above actually exist otherwise there might be errors when attempting to run QGIS Server.

After the above procedures, open XAMPP from the Windows start menu if not running and it will display the control panel and ensure that apache server is already running. Navigate using your browser to http://localhost/cgi-bin/qgis_mapserv.fcgi.exe?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities which opens a an XML (eXtensible Markup Language) page showing the WMS capabilities of the server.