I think I have installed QGIS Server correctly - I get

enter image description here

enter image description here I have followed the process in https://docs.qgis.org/3.16/en/docs/server_manual/getting_started.html#installation-on-windows

I have entered the service capabilities under Project-->Properties-->QGIS Server and used Test Configuration with no problems but where do I put the project and data in so that I can see it as a WMS layer? It seems like section 2.3 is for Linux and not Windows systems.


When I try http://localhost:8080/cgi-bin/qgis_mapserv.fcgi.exe?map=D:\MGM\MapData\animals.qgs&

I get enter image description here

In httpd.conf I have enter image description here

Is there anything else to do?


On trying the edits as per the answer for Apache

My XAMPP enter image description here

My httpd_qgis-ltr.conf

# Parse our QGIS Apache conf files
Include C:/OSGeo4W64/httpd.d/httpd_*.conf

LoadModule fcgid_module modules/mod_fcgid.so

DefaultInitEnv O4W_QT_PREFIX "C:\OSGeo4W64/apps/Qt5"
DefaultInitEnv O4W_QT_BINARIES "C:\OSGeo4W64/apps/Qt5/bin"
DefaultInitEnv O4W_QT_PLUGINS "C:\OSGeo4W64/apps/Qt5/plugins"
DefaultInitEnv O4W_QT_LIBRARIES "C:\OSGeo4W64/apps/Qt5/lib"
DefaultInitEnv O4W_QT_TRANSLATIONS "C:\OSGeo4W64/apps/Qt5/translations"
DefaultInitEnv O4W_QT_HEADERS "C:\OSGeo4W64/apps/Qt5/include"
DefaultInitEnv O4W_QT_DOC "C:\OSGeo4W64/apps/Qt5/doc"

DefaultInitEnv PATH "C:\OSGeo4W64\apps\qt5\bin;C:\OSGeo4W64\bin;C:\OSGeo4W64\apps\qgis-ltr\bin;C:\OSGeo4W64\apps\grass\@grasspath@\bin;C:\OSGeo4W64\apps\grass\@grasspath@\lib;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem"
DefaultInitEnv QGIS_PREFIX_PATH "C:\OSGeo4W64\apps\qgis-ltr"
DefaultInitEnv QT_PLUGIN_PATH "C:\OSGeo4W64\apps\qgis-ltr\qtplugins;C:\OSGeo4W64\apps\qt5\plugins"
DefaultInitEnv TEMP "C:\Users\MANGOA~1\AppData\Local\Temp"
DefaultInitEnv PYTHONHOME "C:\OSGeo4W64\apps\Python37"
DefaultInitEnv PYTHONPATH "C:\OSGeo4W64\apps\Python37;C:\OSGeo4W64\apps\Python37\Scripts"

Alias /qgis-ltr/ C:\OSGeo4W64/apps/qgis-ltr/bin/

<Directory "C:\OSGeo4W64/apps/qgis-ltr/bin/">
    SetHandler fcgid-script
    Options ExecCGI
    # Order/Allow is for Apache 2.2
    #Order allow,deny
    #Allow from all
    # Require is for Apache 2.4
    Require all granted

The fcgi is correct enter image description here

  • I would expect, some response like that from a request in a browser like http://localhost:8080/cgi-bin/qgis_mapserv.fcgi.exe?map=D:\MGM\MapData\animals.qgs& to see the GetCapabilities response you'd need: http://localhost:8080/cgi-bin/qgis_mapserv.fcgi.exe?map=D:\MGM\MapData\animals.qgs&service=WMS&request=GetCapabilities&
    – nmtoken
    Nov 17, 2020 at 21:35
  • If you've set the environment correctly (and restarted Apache), then you'd just use your original request, like: http://localhost:8080/cgi-bin/qgis_mapserv.fcgi.exe?&service=WMS&request=GetCapabilities&
    – nmtoken
    Nov 17, 2020 at 21:40
  • @nmtoken with http://localhost:8080/cgi-bin/qgis_mapserv.fcgi.exe?map=D:\MGM\MapData\animals.qgs&service=WMS&request=GetCapabilities& I get <ServerException>Project file error. For OWS services: please provide a SERVICE and a MAP parameter pointing to a valid QGIS project file</ServerException>
    – GeorgeC
    Nov 17, 2020 at 23:11
  • Parameter names should be case insensitive, but you could try SERVICE and MAP, rather than my service and map
    – nmtoken
    Nov 18, 2020 at 0:33
  • @nmtoken Still get the same issue - can you add some examples from your system? and how the qgs project you load looks? this will allow me to check if I have done things correctly.
    – GeorgeC
    Nov 18, 2020 at 1:24

1 Answer 1


For MapServer (which also uses a map parameter to point at the configuration), the location of the map file(s) read .qgs files here is not important. You just need a location that is readable by the server, so instead of /home/qgis/projects/world.qgs you could have your qgs file(s) at c:\WxS\qgisserver\projects\project1\ and the service endpoint would be


But if you want you can use the Apache server configuration to hide the map location.

For MapServer you'd use:

SetEnvIf Request_URI "/cgi-bin/qgis_mapserv.fcgi.exe" MS_MAPFILE=C:/WxS/qgisserver/projects/project1/world.qgs

Looking at section 2.3 I assume that instead of MS_MAPFILE you need to use PROJECT_FILE like:

SetEnvIf Request_URI "/cgi-bin/qgis_mapserv.fcgi.exe" PROJECT_FILE=C:/WxS/qgisserver/projects/project1/world.qgs

If you plan to have multiple WMS (other OWS services) on the same server, just add a project sub-folder in the cgi-bin.

So the service URL becomes:


and the Apache config:

SetEnvIf Request_URI "/cgi-bin/project1/qgis_mapserv.fcgi.exe" PROJECT_FILE=C:/WxS/qgisserver/projects/project1/world.qgs

In the Apache config file you need to ensure that LoadModule setenvif_module modules/mod_setenvif.so is enabled, and can add the SetEnvIf in the conf file; alternatively you can add the SetEnvIf to its own httpd config file and then point the Apache config to that location.

So you could have:

# Parse our QGISServer Apache conf files
Include C:/WxS/qgisserver/httpd.d/httpd_*.conf

Then have a file called httpd_Project1.conf and in that file you might have:

Alias /Project1/ "C:/WxS/qgisserver/projects/project1/www/"
<Directory "C:/WxS/qgisserver/projects/project1/www/">
    AllowOverride None
    Options FollowSymLinks Multiviews
    Require all granted

SetEnvIf Request_URI "/cgi-bin/project1/qgis_mapserv.fcgi.exe" PROJECT_FILE=C:/WxS/qgisserver/projects/project1/world.qgs

The Alias here allows you to create a set of web pages to accompany your service

That's how it works with MapServer and Apache on Windows.

QGIS is essentially the same

Installing from osgeo4w-setup-x86_64.exe, and selecting the qgis-ltr-server (and dependencies) on a PC that already has Apache (with fcgi), and MapServer, and QGIS installed from other routes...

For example I don't use XAMPP, but use Apache HTTP binaries form ApacheLounge.

Installing to C:\apps\OSGeo4W64

In that folder we have C:\apps\OSGeo4W64\httpd.d and a file httpd_qgis-ltr.conf that gives web server settings.

To get the installed version of Apache to see this configuration, I added

# Parse our QGIS Apache conf files
Include C:/apps/OSGeo4W64/httpd.d/httpd_*.conf

To the Apache httpd.conf file, which on your system I think is at:


and restarted Apache; I used the wildcard to allow the option of adding other configuration files in that location.

In the httpd_qgis-ltr.conf file we have a line Alias /qgis-ltr/ C:\apps\OSGeo4W64/apps/qgis-ltr/bin/ where C:\apps\OSGeo4W64/apps/qgis-ltr/bin/ is the folder with the server executable qgis_mapserv.fcgi.exe

So now we can use:


To get an error warning, that shows us the server is working.

<ServiceExceptionReport version="1.3.0">
    <ServiceException code="Service configuration error">
    Service unknown or unsupported</ServiceException> 

If we add the service=WMS&request=GetCapabilities& parameters we get an empty response like in your first screenshot.


I then created a QGIS project surfaceGeology.qgs and saved it at: C:\WxS\qs\apps\test\1ge I added some information to the QGIS server fields in the layer properties and also to the metadata properties.

QGIS project with metadata

If add the map parameter to the request, I now get a service response for my surfaceGeology project.


The direction of the slashes in the path isn't important (you can use C:\WxS\qs\apps\test\1ge\).

To get QGIS to use the service give the endpoint:


QGIS service added to QGIS desktop

QGIS service, showing legend (WMS GetLegendGraphic) and information (WMS GetFeatureInfo)

  • I have tried the above but am getting an issue -please see updated question.
    – GeorgeC
    Nov 17, 2020 at 20:38
  • 1
    You need to add, service, request, and optionally version parameters to the end point
    – nmtoken
    Nov 17, 2020 at 20:48
  • Can you send me a working example from your system so I can follow the same?
    – GeorgeC
    Nov 17, 2020 at 20:50
  • I just tried this with no luck - the only difference is my Apache is on 8080. I get Not Found error when I try - localhost:8080/qgis-ltr/qgis_mapserv.fcgi.exe? -will update the question with screen grabs now.
    – GeorgeC
    Nov 18, 2020 at 11:00
  • Thanks - I tried to add Include C:/OSGeo4W64/httpd.d/httpd_*.conf to the httpd.conf in C:\xampp\apache\conf but then Apache doesn't start. Should I move the dll files in C:\OSGeo4W64\apps\qgis-ltr\server to the C:\xampp\apache folder? When installing QGIS Server from osgeo4w-setup-x86_64.exe it didn't show anything on where to install it. I have no issue with using Mapserver if this is easier, I was just trying to follow the process in https://docs.qgis.org/3.16/en/docs/server_manual/getting_started.html#installation-on-windows -Can you add some screen grabs of your system working?
    – GeorgeC
    Nov 19, 2020 at 8:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.