Using QGIS, Lizmap Plugin and Web Client to Publish Web Maps

Part 2: QGIS Server and Lizmap

This post is a continuation of the previous Updated Installing Apache, Lizmap Web Client, and QGIS on Windows OS blog post. You need to have a GIS server set up first that uses the Lizmap Web Client. Then you use the Lizmap plugin in QGIS Desktop to help you publish the QGIS project as a web app to your GIS server.

For this tutorial, I assume you already have QGIS Desktop installed. I have both QGIS Desktop LTR 2.18.21 and 3.2 installed on my computer but for this tutorial I am using the LTR 2.18.21 version – as that is the version of my QGIS Server and that my Lizmap Web Client is using. The Lizmap plugin will also work on QGIS desktop 3.2 but is listed as “experimental” so I take it that it hasn’t been fully tested yet(?). For this tutorial, I assume you already know the basics of using QGIS Desktop.

The basic workflow is as follows:

  • Set up working project directory

  • Create and configure QGIS project for the web mapping

  • Install and configure Lizmap plugin

  • Publish QGIS project as web map to Lizmap Web Client

  • View web map online via the Lizmap Web Client

Part 1: Set up working project directory - optional

This part is optional but highly recommended for organizational purposes. Create a working project directory. For my set up I create a batch file (*.bat)  to create my folders. You can of course also create your folder and subfolders manually. Because I have everything (QGIS Server, Lizmap Web Client, and QGIS desktop) all on my laptop for testing, I’m just going to put my webapp folder inside my webserver directory - most likely in reality your GIS Server would be on a separate server. Your folder structure can be whatever fits your needs.

1. I use a batch file to make my folders. You can create a batch file in a text editor (such as NotePad or NotePad++) to create these folders. Below is an example of my folders.

mkdir C:\webserver\webapp\common\
mkdir C:\webserver\webapp\document\
mkdir C:\webserver\webapp\document\svg\
mkdir C:\webserver\webapp\prod\
mkdir C:\webserver\webapp\prod\maprep\
mkdir C:\webserver\webapp\prod\maprep\data
mkdir C:\webserver\webapp\prod\maprep\data\vector
mkdir C:\webserver\webapp\prod\maprep\data\raster
mkdir C:\webserver\webapp\prod\maprep\media\
mkdir C:\webserver\webapp\prod\maprep\media\js\
mkdir C:\webserver\webapp\prod\maprep\media\image\
mkdir C:\webserver\webapp\preprod
mkdir C:\webserver\webapp\preprod\maprep\
mkdir C:\webserver\webapp\preprod\maprep\data
mkdir C:\webserver\webapp\preprod\maprep\data\vector
mkdir C:\webserver\webapp\preprod\maprep\data\raster
mkdir C:\webserver\webapp\preprod\maprep\media\
mkdir C:\webserver\webapp\preprod\maprep\media\js\
mkdir C:\webserver\webapp\preprod\maprep\media\image\

2. Save your *.bat file (e.g. createDir.bat) and then run it in the Command Prompt window.

  • In the Command Prompt window: cd into your directory that contains the *.bat file

  • Run the *.bat file

Part 2: Create and configure QGIS project

1. Create a new QGIS project - add your data layers, style and symbolize them. Save your project to your \webapp\preprod\maprep folder. I am working in my preprod folder or environment and I put everything for my project into their respective folders (created in above step)

Here is a look at my sample project.


2. Configure QGIS project properties. Go to File menu >> Project Properties

See Lizmap configuration for more info: 

  • General Tab: Use option Save Paths = relative ; fill or select other parameter option as you choose.


Note: For Project Scales you can enter manually or write them out into an *.xml file so it can be used for other projects. So example, here is my map scales in feet and as EPSG3857 (e.g. similar to Google Maps)

  • CRS tab: check the option to for enable on the fly CRS transformation and use WGS84 Pseudo Mercator as the project CRS

  • Identify Layers tab: Select the layers that you want identifiable features

  • OWS Server tab: Select Options

    • Enable Service capabilities by checking the box

    • Title - enter a title for your project (this will show up in Lizmap client)

    • WMS Capabilities - check Advertised extent and Use Current Canvas Extent (this will use current map view); Add in CRS restriction if any

    • WFS Capabilities - check layers you want published

    • WCS Capabilities - check layers you want published (note: these are from external web services)

    • Test Configuration - click Launch button and hopefully everything will be good

    • Click OK and save your project


Part 3: Install and configure Lizmap plugin

This part just shows you some of the basic configurations. See Lizmap configuration documentation for more info: 

1. In QIGS, go to Plugins menu >> Manage and Install Plugins. In the Plugins window, search for Lizmap then install the plugin


2. Configure Lizmap. Click on the Lizmap button (looks like a green globe) or go to Web menu >> Lizmap >> Lizmap

  • In the Lizmap window: There are many options and parameters. You can choose whatever you like.

See Lizmap configuration documentation for more info: 

But here's the options I'm using for this example:

Layers tab options: Input metadata and options for each layer in your project


Baselayers tab options: input basemap layer options.


Locate by layer tab options: Here I am adding the Tax Map Parcel (TMK) layer, so I can search by TMK number.


Attribute table tab: Again here I am adding in the Tax Map Parcel layer so it's attribute table will be shown.


That's just some of the basic configuration set up I'm using for this example. After you are done with your set up, click Apply then Close. Also don't forget to save your QGIS project as well. After you apply and save the Lizmap configuration a configuration file (*.qgs.cfg) will be written with the same name of your project. Save your QGIS Project, and if you're happy with everything, then you can copy the project from your preproduction environmental to production for Lizmap web client to consume. For me that means copying everything from ../preprod/maprep to ../prod/maprep.

Thumbnail image for your web app

If you want a custom thumbnail image to be displayed for your web app in the Lizmap web client view PROJECTS page, you can do so by taking an image and naming it with *.qgs.png file extension. Note in my example, I have a *.qgs.png image with same name as my QGIS project, which is really a snapshot of my QGIS map canvas. This image (*.qgs.png) will be used as the thumbnail image of my project web app. The default image for a web project in Lizmap is a black and white world map. You must include the .qgs file extension to your filename and saved in the same location as your *.qgs.cfg and *.qgs files - like this example.


Part 4: Publish QGIS project as web app to Lizmap web client

This step is basically just pushing your QGIS projects to Lizmap web client. See the Lizmap Administration guide for more info:

1. Copy everything from ../preprod/maprep to ../prod/maprep

2. Log into Lizmap web client's Administration dashboard. Go to http://localhost/admin.php and login

3. In the Lizmap Configuration tab: Create a New Repository. You can also remove the default demo and intranet projects if you'd like.

See link for more info:

  • ID: Id of your repository (e.g. oahumap). it seems like you can only use lowercase with no spaces or special characters

  • Label: Name of your repository (e.g. Demo Project)

  • Local Folder Path: path to your QGIS project (e.g. /webserver/webapp/prod/maprep/). Do not include Drive letter or use back slashes in your path.

  • Check the box to allow use of repository themes

  • Click Save - you will see then automatically be able to view the user group rights and check what each types of user group can do

  • Save your modifications


3. Optional - Theme settings: Go into the Theme settings and Modify options if you want for your web app.

If you wan to do more advanced theme creations, see advance lizmap configuration link:


4. Go to the PROJECTS page (button in top right) and you should see your projects. Note you can have more than 1 projects in your repository - I have 2 projects in mine.


Here's what my web map example looks like.


That's basically it for a basic configuration and publishing of QGIS project to Lizmap web client. You'll notice in my web app that I have added a google-satellite basemap and an overview map - these are advance configurations which are explained below.

Step 5: Some Advance Configurations and Caveats

For more info on advance configuration of Lizmap plugin and web client see:

Adding an overview map

To add an overview map to your web app, you just add a group layer in QGIS with the named "Overview" (without quotes) - this will indicate to Lizmap web client to use it as the overview map. Then add your data layers to the group - in my example, I'm only using a stamen-toner web service in my overview map.

  • In QGIS, create a group layer and name it Overview

  • Add your data layers to your Overview Group


Adding basemaps for viewing and printing

Note: If you need help adding basemaps, see my posting on Adding Basemaps in QGIS

There are basically 2 ways you can add basemaps to your web app: 1) via Baselayers tab and 2) as a group or layer(s) in QGIS project

The first way is quick and easy way - you just check the basemap options (e.g. Google, OpenStreetmap, Bing, IGN (France) in Baselayers tab in the Lizmap plugin configuration window.  However, adding basemaps via the Baselayers tab will not print as these basemaps are external to your QGIS project -  see    

To work around this, you need to add the basemap(s) as a group or layer in QGIS whose name is part of the following list - these corresponds with the external basemaps in the Baselayers tab of Lizmap plugin.

NOTE: Remember you still have to be in compliance with the licensing terms of all the basemaps you use.

  • osm-mapnik for OpenStreetMap

  • osm-mapquest for MapQuest OSM

  • osm-cyclemap for OSM CycleMap

  • google-satellite for Google Satellite

  • google-hybrid for Google Hybrid

  • google-terrain for Google Terrain

  • google-street for Google Streets

  • bing-road for Bing Road

  • bing-aerial for Bing Aerial

  • bing-hybrid for Bing Hybrid

  • ign-scan for IGN Scan

  • ign-plan for IGN Plan

  • ign-photo for IGN Photos

Below is the options I used in my example - also see snapshot.

  • In QGIS, I used the QuickMapServices plugin to add in these basemaps: Google Satellite, Open Topo Map, and ESRI Topo.

  • Rename Google Satellite to "google-satellite" (without quotes and to match the naming convention from list above). I left OpenTopoMap and ESRITopo as is since they're not in the list above)

  • Create a Group and call it "hidden". Then create sub-group named "osm-mapnik" which contains the OSM Standard basemap, and sub-group named "osm-stamen-toner" which contains the Stamen Toner Lite basemap

  • In Lizmap plugin configuration, Layers tab:

    • For google-satellite, OpenTopoMap, and ESRITopo, check base layer? option (these are not part of the default Lizmap baselayers and I want to use them as Basemaps). Also check option for use Single Tile?

    • For hidden groupings: No need to check option to use as base layers since these are hidden anyway and will only be used for printing purpose. Also these are already part of the default lizmap baselayers options and you don't want duplicate basemaps in your web app.

  • Check box to Hide checkboxes for Groups

  • Save your Lizmap configuration and QGIS Project


Printing basemaps in your web app in Lizmap web client viewer

Printing basempas in your web app via the Lizmap web client viewer is a bit tricky. First you need to have a print composition in your QGIS project and it needs to have at least 1 map in it and you also need to enable the printing function in Map options tab of the Lizmap plugin configuration window.


Printing basemaps in Lizmap may not always work. One big caveat is, you cannot have text labels in your print composition - otherwise you will get an "Internal Server Error" and your map will not print. It seems to me that the printing of basemaps can sometimes be finicky. I've gotten errors even after I've removed text labels in my print compositions - something about the basemap layer not being found or define (e.g. Layer "osm-mapnik" not found). What I did for this error was to clear my cache and log off and log back into my Lizmap Administration page - this worked for me.

I'm not sure if printing basemap issues are from Lizmap's end or QGIS Server. I've seen on some forums, suggestions for installing a fake X server but that's for Linux and/or Mac OS - I don't think that's an option for Windows OS. This makes me think it's a QGIS Server issue, but I don't know. By the way, printing of basemaps in the QGIS project works fine - it's just the printing in the web app that can be a problem.

Here's an example of my print composition. It is a simple A4 landscape layout. Create your print compositions and save your project, then in the web app you can select the layout to use as template for printing.


Here's an example of the printing function in my web app. Using the print function is pretty self explanatory.


Here are some snapshots of print pdf maps with each of the different basemaps selected for printing in my web app.

PDF with OSM Stamen Toner basemap (it's actually stamen toner lite)

PDF with OSM Stamen Toner basemap (it's actually stamen toner lite)

PDF with Open Streetmap basemap

PDF with Open Streetmap basemap

PDF with Google Satellite basemap

PDF with Google Satellite basemap

PDF with ESRI Topo basemap

PDF with ESRI Topo basemap

PDF with Open Topo Map basemap

PDF with Open Topo Map basemap

Ok, so that's it for this tutorial. Thanks for reading!

Updated - Installing Apache, QGIS Server, and Lizmap Web Client on Windows OS

Part 1: QGIS Server and Lizmap

NOTE: This post has been updated to include my configuration files for those who want to compare their own files with mine. You can download the files at the end of this post. Please keep in mind that I cannot guarantee that this process will work for you.

This is an updated version of my previous blog post on installing Apache, QGIS Server, and Lizweb Map on Windows OS - this time using Apache 2.4.33, QGIS Server LTR 2.18.21 and Lizmap Web Client 3.1.12. I just updated my Windows Server 2016 and needed to redo my GIS server. This post includes screenshots so hopefully it will be more helpful with details. This shows the process on my Windows 10 Pro laptop but should be the same for a Windows Server 2016 (which I've done at my work). If this helps you or if you find any errors or have any suggestions, let me know in the comments section.

For my test on my Windows 10 Pro laptop, I have everything on the same machine. But on the Windows Server 2016 machine, I have QGIS Desktop with Lizmap Web Plugin on a different machine. For my installation I put Apache and Lizmap side-by-side inside a C:/webserver directory. You can however, put your installations inside of Apache root directory (e.g. C:/Apache24/Lizmap) or inside Apache htdocs directory (e.g. C:/Apache24/htdocs/lizmap). If installation of Lizmap and Apache are side by side or Lizmap is inside Apache root directory then you need to properly configure the virtual hosts.

Software Used/Requirements:

  • Lizmap and QGIS Server must be on same machine

  • QGIS Server LTR 2.18.21 (installed via OSGeo4W x64)

  • QGIS Desktop (installed via OSGeo4W x64)

  • Lizmap Web Plugin (installed via QGIS Desktop plugin manager)

  • Lizmap Web Client 3.1.12

  • Apache 2.4.33

    • mod fcgid

    • C++ Redistributable VS 2015

    • PHP 7.2.7

Part 1: Set up workspace

You can choose how you set up your workspace environment, but for this guide the following setup is used.      

1. Optional - turn off IIS if enabled in Windows. I have it enabled so I turned if off so I can use the default port 80.

2. Set up a home workspace on your local drive - for simplicity sake, I have a directory called webserver on my drive that I will use as my workspace (e.g. C:\webserver)

Part 2: Install and Configure Apache

For more info on using Apache for Windows - see this link:

1. Download Apache and needed components

Go to page and download the appropriate software for your Windows OS. Here's what I'm using:

Note: The Visual C Redistributable Package is needed to run Apache HTTPD as a Windows Service but the version required will depend on which binary you are installing: If you are installing Apache 2.4 VC15 then you need Microsoft Visual Studio C 2017 Redistributable.

Be sure !! that you have installed the latest C++ Redistributable Visual Studio 2017 -  Install this package first if you don't already have it installed : vc_redist_x64 or vc_redist_x86

2. Install the C++ VS 2017 redistributable that you downloaded first if you don't have it installed already

3. Extract from the Apache24 folder and put into your webserver directory (e.g. C:\webserver\Apache24)

4. Extract\mod_fcgid-2.3.9 folder then copy and put into your \Apache24\modules folder (e.g. C:\webserver\Apache24\modules)

5. Change configuration in \Apache24\conf\httpd.conf file (e.g. C:\webserver\Apache24\conf\httpd.conf). In a text editor (I use notepad++) open the httpd.conf file and edit it

a. Replace all occurrences of c:/Apache24 to c:/webserver/Apache24 or where ever you have your Apache24 folder.

b. Find where it says “ServerName” – this should be ServerName localhost:80 (if using default port 80) or if not using default port then it should be ServerName localhost:port (e.g. ServerName localhost:90).

  • Uncomment the ServerName line - that is remove the # character

  • Change from ServerName to ServerName localhost:80


c. Optional - Find where it says “Listen 80” to and change the port number if not using the default 80 (e.g. Listen 90). You need to use a port that is not already in used by another service.

d. Find where it says “DirectoryIndex index.html” and add index.php (e.g. DirectoryIndex index.html index.php)


e. Save your changes. You can keep the configuration file open

6. Check to see if Apache will start. To quickly check to see Apache configurations work and to see if Apache starts up correctly you can run the httpd.exe as a console application. You can use the command window (CMD) to run the httpd.exe or go into the directory where httpd.exe is located and run as admin.

a. Go to \Apache24\bin folder (e.g. C:\webserver\Apache24\bin) and right click on httpd.exe and run as administrator

b. If you get a pop up, allow the app to run - you should then get a console window (black window) that pops up - keep this window open (if you close it, Apache will stop)


c. Then in a web browser type in http://localhost or http:localhost:port and you should see a webpage with "It Works!" This means Apache is installed correctly

d. To stop Apache you can just close the console window (black window above)

7. Run Apache as a Windows Service rather than as a console application. Running as a service should be preferred because this lets Apache end any current operations and clean up gracefully. See for more info.

a. Optional - Append Apache to your Windows System Path so you can directly access Apache by just typing httpd.exe instead of the full pathname to it.


b. Start Apache as Windows Service:

  • Go to the Command Prompt (CMD) and run as administrator

  • Install Apache as a service: httpd.exe -k install

  • Open your Windows Services Manager: you should see Apache as a listed service.

    • Select Apache service and start it

    • Then in web browser, try http://localhost or http://localhost:port and you should get "It Works!"

    • Stop the Apache service for now as you'll do more configuration - you can keep the services window open

Note: If you would rather start, stop, restart Apache in the Command Prompt window: use httpd.exe -k restart, httpd.exe -k shutdown


8. Edit Apache configuration (httpd.conf) to enable needed modules. Open Apache24\conf\httpd.conf  (e.g. C:\webserver\Apache24\conf\httpd.conf) and edit it.

a. Remove the # character in front of each of the following module to enable it.

Note: If you don't see the module already in the file then you need to type it in - for example I had to insert module

  • LoadModule actions_module modules/

  • LoadModule deflate_module modules/

  • LoadModule expires_module modules/

  • LoadModule ext_filter_module modules/

  • LoadModule fcgid_module modules/

  • LoadModule headers_module modules/

  • LoadModule ident_module modules/

  • LoadModule rewrite_module modules/

  • LoadModule ssl_module modules/

Note: If you are using a different port than the default 80 then you need to also enable these modules as well.

  • LoadModule cache_module modules/

  • LoadModule cache_disk_module modules/

  • LoadModule proxy_module modules/

  • LoadModule proxy_connect_module modules/

  • LoadModule proxy_fcgi_module modules/

  • LoadModule proxy_http_module modules/

b. Add the following code to the end of the httpd configuration file:

<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\\.0[678] no-gzip
BrowserMatch \\bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Reuqest_URI \\.(?:gif|jpe?g|png|rar|zip)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary

9. Save your changes to the configuration file and restart Apache service. See if you can still access Apache on localhost or localhost:port. I like to restart and check after each set of configuration changes so it's easy to keep track of errors should something not work.

Part 3: Install and Configure PHP

1. Go to PHP download page and download the appropriate file for your OS and Apache version installed from Part 2. I am using PHP 7.2 (7.2.7) VC15 x64 Non Thread Safe 

2. Create a new php folder, called php72 or whatever you want. Extract the zipped file contents to your PHP folder inside your main webserver directory (e.g. C:\webserver\php72).

3. In the php folder there is a php-ini-production file, make a copy of this and rename the copy to php-ini - this will be the php configuration file you edit


4. Open php.ini file (e.g. C:\webserver\php72\php.ini) in a text editor and make the following changes

a. Find where it says ;extension_dir = "ext" and remove the ; character and replace "ext" with the path to your php ext folder (e.g. "C:/webserver/php72/ext")


b. Enable the following php modules by removing the ; character

  • extension=php_curl

  • extension=php_fileinfo.

  • extension=php_gd2

  • extension=php_mbstring

  • extension=php_pdo_pgsql

  • extension=php_pdo_sqlite.

  • extension=php_pgsql

  • extension=php_sqlite3


c. Find where it says "upload_max filesize" and change it to 15M

d. Find where it says "post_max_size" and change it to 15M


e. Save your configuration changes to the php.ini file

5. Add PHP to your Windows System Path (e.g. add C:\webserver\php72 to your Windows system path - same as in Part 2, step 7)

6. Open Command Prompt and check to see if PHP is correctly declared in system path: run CMD as admin, then type in php -m. You should get a list of php modules back.


Part 4: Configure Apache for Using PHP

1. Open a new file in a text editor then put in the following code - save the file as php72.conf in \Apache24\conf\extra folder (e.g. C:\webserver\Apache24\conf\extra\php72.conf)

FcgidInitialEnv PHPRC "C:\\webserver\\php72"
 <FilesMatch \\.php$>
  AddHandler fcgid-script .php
  FcgidWrapper "C:/webserver/php72/php-cgi.exe" .php

2. Open and edit Apache httpd.conf file (e.g. C:\webserver\Apache24\conf\httpd.conf)

  • Uncomment or remove the # character: Include conf/extra/httpd-vhosts.conf

  • Save changes to file


3. Open and edit httpd-vhosts.conf file (e.g. C:\webserver\Apache\Conf\extra\httpd-vhosts.conf ) for use with Lizmap

a. Delete the two examples that are included in the file and insert the following code. Note: don't forget to change the port if you're using something other then default 80

<VirtualHost *:80>
  Include conf/extra/php72.conf
  ServerName localhost
  DocumentRoot "C:/webserver/lizmap/"

  <Directory "C:/webserver/lizmap">
      Options -Indexes +FollowSymLinks +ExecCGI
      AllowOverride All
      Require all granted

  CustomLog "logs/lizmap-access.log" common
  ErrorLog "logs/lizmap-error.log"

4. Create a lizmap folder inside the main webserver directory (e.g. C:\webserver\lizmap)

5. Create a text file with following code and save it as index.php inside the lizmap folder (e.g. C:\webserver\lizmap\index.php)


6. Restart Apache service

7. Check to see if PHP works. In a web browser, type in http://localhost/index.php (or http://localhost:port/index.php if not using default 80)


Part 5: Install and Configure QGIS Server

I installed QGIS Server using OSGeo4W installer x64 version – download on QGIS site or on OSGeo4W site. Lizmap Web Client doesn’t work properly with the QGIS Server 3.0 , so you must use the LTR 2.18.21. I did try with QGIS Server 3.x but it didn’t work. Note: I have both QGIS dekstop 3.2 and 2.18.21 and QGIS Server 2.18.21 on my machine and they both work fine so far.

If you don't already have QGIS desktop then you have the option to install it via Express install using the OSGeo4W installer (this is easier) or through the advance option.

1. Run the OSGeo4W installer: Select Advance Setup

a. Install from Internet

b. Keep Root Directory default and install for all users

c. Keep default Local Package Directory and Start Menu Name

d. Select these Packages:

  • Commandline_Utilities: GDAL

  • Desktop: QGIS LTR 2.18.21 full (if needed)

  • Libs: fcgi

  • Optional Lib: filegdb (only if you want to be able to use ESRI file gdb)

  • Web: QGIS Server LTR 2.18.21

e. Resolve Un-met Dependencies: Install the required dependencies, accept license agreements, and allow installation to complete


2. After installation completes, check in C:\OSGeo4W64\apps\qgis-ltr\bin folder to make sure these files are in there.

  • qgis_mapserv.fcgi.exe

  • qgis_server.dll

  • wms_metadata.xml

3. Configure QGIS server to be accessible as fcgi. Open httpd-vhosts.conf file (e.g. C:\webserver\Apache\Conf\extra\httpd-vhosts.conf ) and edit it to contain the following code. Save the file when done.

<VirtualHost *:80>
  Include conf/extra/php72.conf
  ServerName localhost

# Lizmap Production
DocumentRoot "C:/webserver/lizmap/prod/"
<Directory "C:/webserver/lizmap/prod">
    Options -Indexes +FollowSymLinks +ExecCGI
    AllowOverride All
    Require all granted

# LizMap Pre-production
Alias /preprod/ "C:/webserver/lizmap/preprod/"
<Directory "C:/webserver/lizmap/preprod">
    Options -Indexes +FollowSymLinks +ExecCGI
    AllowOverride All
    Require all granted

Alias /qgis/ "C:/OSGeo4W64/apps/qgis-ltr/bin/"
<Directory "C:/OSGeo4W64/apps/qgis-ltr/bin/">
    SetHandler fcgid-script
    Options +ExecCGI
    AllowOverride All
    Require all granted

Alias /document/ "C:/webserver/data/document/"
<Directory "C:/webserver/data/document">
    Options -Indexes +FollowSymLinks
    AllowOverride All
    Require all granted

CustomLog "logs/lizmap-access.log" common
ErrorLog "logs/lizmap-error.log"

4. Open php72.conf that you created earlier (e.g. C:\webserver\Apache24\conf\extra\php72.conf) and modify it to include the following code. Save your changes to the file.

FcgidInitialEnv PHPRC "C:\\webserver\\php72"

FcgidInitialEnv PATH "C:\OSGeo4W64\bin;C:\OSGeo4W64\apps\qgis-ltr\bin;C:\OSGeo4W64\apps\grass\grass-6.4.3\lib;C:\OSGeo4W64\apps\grass\grass-6.4.3\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\WBem"
 FcgidInitialEnv QT_PLUGIN_PATH "C:\OSGeo4W64\apps\qgis-ltr\qtplugins;C:\OSGeo4W64\apps\Qt4\plugins"
 FcgidInitialEnv PYTHONHOME "C:\OSGeo4W64\apps\Python27"
 FcgidInitialEnv PYTHONPATH "C:\OSGeo4W64\apps\qgis-ltr\.\python;C:\OSGeo4W64\apps\qgis-ltr\.\python\plugins;C:\OSGeo4W64\apps\Python27\DLLs;C:\OSGeo4W64\apps\Python27\lib;C:\OSGeo4W64\bin;C:\OSGeo4W64\apps\Python27;C:\OSGeo4W64\apps\Python27\lib\site-packages"

FcgidInitialEnv QGIS_SERVER_LOG_FILE "C:\\webserver\\Apache24\\logs\\qgis_server.log"

FcgidIOTimeout 120
      FcgidInitialEnv LC_ALL "en_US.UTF-8"
      FcgidInitialEnv PYTHONIOENCODING UTF-8
      FcgidInitialEnv LANG "en_US.UTF-8"
      FcgidInitialEnv QGIS_DEBUG 1
      FcgidInitialEnv QGIS_SERVER_LOG_FILE "C:\\webserver\Apache24\logs\\qgis_server.log"
      FcgidInitialEnv QGIS_SERVER_LOG_LEVEL 0
      FcgidInitialEnv QGIS_PLUGINPATH "C:\OSGeo4W64\apps\qgis-ltr\python\plugins"

SetEnvIf Request_URI ^/qgis QGIS_PREFIX_PATH "C:\OSGeo4W64\apps\qgis-ltr"
SetEnvIf Request_URI ^/qgis TEMP "C:\Windows\Temp"

SetEnvIf Request_URI ^/qgis GDAL_DATA "C:\OSGeo4W64\share\gdal"
SetEnvIf Request_URI ^/qgis GDAL_DRIVER_PATH "C:\OSGeo4W64\bin"
SetEnvIf Request_URI ^/qgis PDAL_DRIVER_PATH "C:\OSGeo4W64\bin"
SetEnvIf Request_URI ^/qgis GDAL_SKIP "JP2ECW"
SetEnvIf Request_URI ^/qgis PROJ_LIB "C:\OSGeo4W64\share\proj"

 <FilesMatch \.php$>
  AddHandler fcgid-script .php
  FcgidWrapper "C:/webserver/php72/php-cgi.exe" .php

5. Restart Apache Service

6. In a web browser, see if you can access the QGIS Server:

Note: Typing in the following as noted in the Lizmap installation documentation: http://localhost/qgis/qgis_mapserv.fcgi.exe will give you an error "Service unknown or unsupported"

Type in this below: you should see the default content of the wms_metadata.xml file - this means QGIS Server was installed correctly and accessed as fcgi.



NOTE (2/18/2019): You may also get something like “This XML file does not appear to have any style information associated with it. The document tree is shown below.” You should still be ok as long as you are not getting a “SERVICE UNKNOWN or UNSUPPORTED” error.

The image below looks different than the one above - the wms_metadata.xml for QGIS server may be slightly different from when I wrote the blog post. So just keep in mind that if you are getting some sort of descriptive text back about the WMS service and not an actual error then you are ok and can proceed.

If you get something that looks like this you are ok -  your QGIS Server installation is ok.

If you get something that looks like this you are ok - your QGIS Server installation is ok.

Part 6: Install and Configure Lizmap Web Client

1. Download Lizmap Web Client – I used

2. Create in C:\webserver\lizmap directory, 2 new folders for your production and preproduction work. Make sure you have write access to these folders

  • C:\webserver\lizmap\prod

  • C:\webserver\lizmap\preprod

3. Create in C:\webserver directory a new cache directory to hold 2 new subfolders: prod and preprod. Make sure you have write access to these folders

  • C:\webserver\cache\prod

  • C:\webserver\cache\preprod

4. Unzip or extract lizmap-web-client-3.1.12zip to C:\webserver\lizmap\prod directory. So what you end up having is C:\webserver\lizmap\prod\lizmap-web-client-3.1.12

5. Open C:/webserver/Apache24/conf/extra/httpd-vhosts.conf in text editor and modified the section to the virtual host to point to C:/webserver/lizmap/prod/lizmap-web-client-3.1.12/lizmap/www folder - like the content below

<VirtualHost *:80>
  Include conf/extra/php72.conf
  ServerName localhost

# Lizmap Production
DocumentRoot "C:/webserver/lizmap/prod/lizmap-web-client-3.1.12/lizmap/www/"
<Directory "C:/webserver/lizmap/prod/lizmap-web-client-3.1.12/lizmap/www/">
    Options -Indexes +FollowSymLinks +ExecCGI
    AllowOverride All
    Require all granted

# LizMap Pre-production
Alias /preprod/ "C:/webserver/lizmap/preprod/lizmap-web-client-3.1.12/lizmap/www/"
<Directory "C:/webserver/lizmap/preprod/lizmap-web-client-3.1.12/lizmap/www/">
    Options -Indexes +FollowSymLinks +ExecCGI
    AllowOverride All
    Require all granted

Alias /qgis/ "C:/OSGeo4W64/apps/qgis-ltr/bin/"
<Directory "C:/OSGeo4W64/apps/qgis-ltr/bin/">
    SetHandler fcgid-script
    Options +ExecCGI
    AllowOverride All
    Require all granted

Alias /qgis/ "C:/OSGeo4W64/apps/qgis-ltr/bin/"
<Directory "C:/OSGeo4W64/apps/qgis-ltr/bin/">
    SetHandler fcgid-script
    Options +ExecCGI
    AllowOverride All
    Require all granted

# ABP: needed for authentication in Lizmap
<IfModule mod_fcgid.c>
    RewriteEngine on
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

CustomLog "logs/lizmap-access.log" common
ErrorLog "logs/lizmap-error.log"


6. Restart Apache Service

7. Open the Command Prompt window (run as Administrator) and type in the following lines - for copying some lizmap files

cd C:\\webserver\\lizmap\\prod\\lizmap-web-client-3.1.12\\
cd lizmap/var/config
copy lizmapConfig.ini.php.dist lizmapConfig.ini.php
copy localconfig.ini.php.dist localconfig.ini.php
copy profiles.ini.php.dist profiles.ini.php
cd ../../..

8. Keep your command prompt window open

9. Open Lizmap's localconfig.ini.php file  (e.g. C:\webserver\lizmap\prod\lizmap-web-client-3.1.12\lizmap\var\config\localconfig.ini.php) in a text editor and include the following code if you want to install the Lizmap demo websites – make sure you have admin rights to modify and save this file (e.g. run notepad++ as Administrator then modify and save changes).


10. Back in the Command Prompt, launch Lizmap installation by typing in the following lines. After installation completes, close the command prompt window.

cd C:\webserver\lizmap\prod\lizmap-web-client-3.1.12\
php lizmap/install/installer.php

11. In  web browser, type in http://localhost/index.php - you should see the Lizmap demo page


The Lizmap Web Client Dashboard

1. In the Lizmap home page (see above image), click the Connect button in the top right or go to http://localhost/admin.php to access the login page:

  • Login with default username = admin, password = admin

2. Once you log in you can see the Admin dashboard, don't forget to change password (in My Account). Notice there is an additional intranet demo in the dashboard


3. Lizmap Configuration menu: Modify the Lizmap generic configuration - input as follows and then save new configuration.

  • QGIS server version: >= 2.18

  • WMS Server URL:

  • Cache root directory: C:/webserver/cache/prod/

Note: if you get a error when trying to update the cache root directory to the folder that you created earlier - make sure you have write access to the location first then reload Lizmap demo again.


4. Click over to PROJECTS (top right corner) and you can view the metadata of the demo or load the demo map

Here is the Montpellier Demo web app.


Part  7: SVG and QGIS Bug

I’m not sure if this still hold true or not, but not a bad idea to do it. In Apache you need to Add a vhost to publish SVG and images files via HTTP this will avoid the bug in QGIS Server under Windows which cannot display SVG icon when you have a relative path.

1. Create a folder to contain the svg files  (e.g. C:/webserver/data/document/svg)

2. Then modify C:/webserver/Apache24/conf/extra/httpd-vhosts.conf . Add the codes before the CustomLog portion.

Alias /document/ "C:/webserver/data/document/"
<Directory "C:/webserver/data/document/">
    Options -Indexes +FollowSymLinks
    AllowOverride All
    Require all granted

3. Save and restart Apache service.

4. Check if you can add svg file in the folder C:/webserver/webapp/document/svg then access it via http://localhost/document/svg/my_icon.svg and use it as the SVG path in the style properties of a vector layer.

That's it for this post. I hope this helps you get your GIS server running. See Lizmap Documentation for more info on configuration and user/publisher manual.


These have *.txt file extension to them for downloading purpose.

See Part 2 - on how to use the Lizmap plugin for QGIS to prepare and publish a QGIS project. If you've read this entire post then thank you for reading and I hope it worked out for you. Until next time.