What is the best way to add the QGIS Server capabilities to an existing web server running under Windows?
Specifically, I have WAMPServer 2.2 installed and running on Windows Server 2012, and would now like to add the capability to serve WFS layers. On a different machine (running Windows 7) I have successfully set up QGIS Desktop and Server via the OSGeo4W installer, but now I want to achieve the same result without installing a second version of Apache.
The tutorials I have found are either for linux/unix-type systems, are several years old and use pre-2.0 versions of QGIS, or use the OSGeo4W installer to create a new Apache installation.
I haven't been able to find an individual installer for a Windows version of QGIS Server, and it doesn't appear to be part of the QGIS Standalone Installer.
Best Answer
It turns out that this is a relatively straightforward process for Apache, but since I still haven't seen any walkthroughs for it online I figured I'd list the steps that worked for me here. I used the 64-bit version (of all components, OSGeo4W, Apache, and mod_fcgid) with Apache 2.4, but I presume the 32-bit version will be very similar, as will be other 2.x versions of Apache.
Download and run the OSGeo4W(64) installer (https://www.qgis.org/en/site/forusers/download.html)
Advanced Install
option, and then your installation source%OSGEO%
, and your other preferences on that screenSelect Packages
screen, choose the two packagesDesktop / qgis: QGIS Desktop
andWeb / qgis-server: QGIS Server
, then clickNext
Install these packages...
option is checked when it prompts you about missing packages, and clickNext
againOnce the installation is complete, copy
%OSGEO%\httpd.d\httpd_qgis.conf
to%APACHE%\conf\extras
, where%APACHE%
is the existing base directory of your Apache installation.Edit
%APACHE%\conf\httpd.conf
and add the following to the# Supplemental configuration
section:Include conf/extra/httpd_qgis.conf
If you don't already have the Microsoft Visual C++ 2010 SP1 redistributable, download and install it (http://www.microsoft.com/download/en/details.aspx?id=13523)
Download the Apache FastCGI module (I found the 64-bit version of
mod_fcgid
at http://www.apachelounge.com/download/win64/)mod_fcgid/mod_fcgid.so
to%APACHE%\modules
Restart the Apache service
You should be able to get a valid response from
http://localhost/qgis/qgis_mapserv.fcgi.exe?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
Update for Apache 2.4 security: I just went through this process again, with newer versions of the software: Apache 2.4.9 and QGIS 2.4. There was one additional step to gain access to the WMS. After following the above steps, trying to access the link in Step 7 gave a 403 Forbidden response. This is because the
httpd_qgis.conf
file included with QGIS uses the older Apache access directivesOrder allow,deny
andAllow from all
. If you encounter this problem, comment out those lines and add inRequire all granted
in their place.