4. Plugin-uri

4.1. Instalarea

Pentru a instala pluginul HelloWorld, în scopul testării serverelor, mai întâi trebuie să creați un director de stocare a plugin-urilor. Acesta va fi specificat în configurația gazdei virtuale și va fi transmis serverului printr-o variabilă de mediu:

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

4.2. Configurarea serverului HTTP

4.2.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"

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>

Apoi, restartați Apache:

systemctl restart apache2

4.3. Cum se utilizează un plugin

Testați serverul cu plugin-ul HelloWorld:

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

You can have a look at the default GetCapabilities of the QGIS server at:

http://localhost/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities