Outdated version of the documentation. Find the latest one here.

Plug-ins

Installeren

U dient eerst een map aan te maken waar de plug-ins voor de server komen te staan om de voorbeeld plug-in HelloWorld voor het testen van de servers te installeren. Die zal worden gespecificeerd in de configuratie van de virtuele host en worden doorgegeven aan de server door middel van een omgevingsvariabele:

$ sudo mkdir -p /opt/qgis-server/plugins
$ cd /opt/qgis-server/plugins
$ sudo wget https://github.com/elpaso/qgis-helloserver/archive/master.zip
# In case unzip was not installed before:
$ sudo apt-get install unzip
$ sudo unzip master.zip
$ sudo mv qgis-helloserver-master HelloServer

Configureren van de HTTP-server

Apache

FastCGI moet, om in staat te zijn de plug-ins voor de server te kunnen gebruiken, weten waar die te vinden. We moeten dus het configuratiebestand van Apache aanpassen om de omgevingsvariabele QGIS_PLUGINPATH aan te geven voor FastCGI:

FcgidInitialEnv QGIS_SERVER_LOG_FILE /tmp/qgis-000.log
FcgidInitialEnv QGIS_SERVER_LOG_LEVEL 0
FcgidInitialEnv QGIS_PLUGINPATH "/opt/qgis-server/plugins"

Moreover, a basic HTTP authorization is necessary to play with the HelloWorld plugin previously introduced. So we have to update the Apache configuration file a last time:

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

Start Apache dan opnieuw:

$ sudo a2ensite 001-qgis-server
$ sudo service apache2 restart

Tip

Als u werkt met een object dat vele knopen heeft dan zal het aanpassen en toevoegen van een nieuw object mislukken. In dit geval is het mogelijk de volgende code in te voegen in het bestand 001-qgis-server.conf:

<IfModule mod_fcgid.c>
FcgidMaxRequestLen 26214400
FcgidConnectTimeout 60
</IfModule>

Hoe een plug-in te gebruiken

De server testen met de plug-in HelloWorld:

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

U kunt de standaard GetCapabilities van de QGIS server bekijken op: http://localhost/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities