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

Plugins

Instalación

La instalación de un complemento de ejemplo HelloWorld para probar los servidores. Se puede crear un directorio para mantener los complementos del servidor. Esto se especificará en la configuración del host virtual y transmitirlo al servidor a través de una variable de entorno.

$ 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

HTTP Server configuration

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_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>

A continuación, reinicie Apache:

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

Truco

If you work with a feature that has many nodes then modifying and adding a new feature will fail. In this case it is possible to insert the following code into the 001-qgis-server.conf file:

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

How to use a plugin

Test the server with the HelloWorld plugin:

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

Se puede echar un vistazo al GetCapabilities predeterminado del servidor QGIS en : http://localhost/cgi-bin/qgis_mapserv.fcgi?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities