5. Extensions

5.1. Liste d’extensions

Les extensions peuvent également être installées sur QGIS Server.

Some plugins designed for server can be found on the official QGIS repository.

Install only plugins you need for your own purpose. On QGIS server, plugins are like hooks into QGIS server, they can alter inputs or outputs of QGIS server. They can produce unexpected result if you don’t know how the plugin works. Please refer to their respective documentation or the application that needs QGIS server plugins to know which plugin can be useful for you.

5.2. Emplacement des extensions

By default, on Debian based systems, QGIS Server will look for plugins located in /usr/lib/qgis/plugins. The default value is displayed when QGIS Server is starting, in the logs. It’s possible to set a custom path by defining the environment variable QGIS_PLUGINPATH in the web server configuration.

5.3. Installation

5.3.1. Manuellement depuis un fichier ZIP

As an example, to install the HelloWorld plugin for testing the server, using a specific folder, you first have to create a directory to hold server plugins. This will be specified in the virtual host configuration and passed on to the server through an environment variable:

mkdir -p /var/www/qgis-server/plugins
cd /var/www/qgis-server/plugins
wget https://github.com/elpaso/qgis-helloserver/archive/master.zip
unzip master.zip
mv qgis-helloserver-master HelloServer


According to its description, HelloServer plugin is designed for development and demonstration purposes. Do not keep this plugin for production if you don’t need it.

5.3.2. Avec un outil en ligne de commandes

If you need to install and regularly upgrade plugins which are stored in the QGIS plugin repository, you may use the QGIS-Plugin-Manager. It’s a tool to help you manage plugins from the command line.

The installation is using pip. Installing in a virtual environment is a good practice but not required:

pip3 install qgis-plugin-manager

Pour mettre à niveau l’outil :

pip3 install --upgrade qgis-plugin-manager

Then, you can use the qgis-plugin-manager executable from the command line:

cd /var/www/qgis-server/plugins
qgis-plugin-manager list

QGIS server version 3.19.0
List all plugins in /var/www/qgis-server/plugins

|  Folder                    |  Name              |  Version  |  Experimental  |  QGIS min  |  QGIS max  |  Author                    |  Action           |
|wfsOutputExtension          |wfsOutputExtension  |1.6.2      |                |3.0         |            |3Liz                        |                    |
|qgis_server_render_geojson  |GeoJson Renderer    |v0.4       |                |3.4         |            |Matthias Kuhn (OPENGIS.ch)  |                    |
|DataPlotly                  |Data Plotly         |3.7.1      |                |3.4         |3.98        |Matteo Ghetta (Faunalia)    |Upgrade to 3.8.1    |

We suggest you to read the full documentation in the readme file to know how to install or upgrade plugins with this tool.

5.4. Configuration d’un serveur HTTP

5.4.1. Apache

To be able to use server plugins, FastCGI needs to know where to look. So, we have to modify the Apache configuration file to indicate the QGIS_PLUGINPATH environment variable to FastCGI:

FcgidInitialEnv QGIS_PLUGINPATH "/var/www/qgis-server/plugins"

De plus, une autorisation basique HTTP est nécessaire pour utiliser l’extension HelloWorld citée précédemment. Donc, nous devons mettre à jour une dernière fois le fichier de configuration Apache :

# Needed for QGIS HelloServer plugin HTTP BASIC auth
<IfModule mod_fcgid.c>
    RewriteEngine on
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

Puis, redémarrez Apache :

systemctl restart apache2

5.5. Comment utilisez une extension ?

Testez le serveur avec l’extension HelloWorld :

wget -q -O - "http://localhost/cgi-bin/qgis_mapserv.fcgi?SERVICE=HELLO"

Vous pouvez consulter les GetCapabilities par défaut du serveur QGIS sur: