To log requests sent to the server, set the following environment variables:
QGIS_SERVER_LOG_FILE: Specify path and filename. Make sure that the server has proper permissions for writing to file. File should be created automatically, just send some requests to server. If it’s not there, check permissions.
QGIS_SERVER_LOG_LEVEL: Specify desired log level. Available values are:
Example:
SetEnv QGIS_SERVER_LOG_FILE /var/tmp/qgislog.txt
SetEnv QGIS_SERVER_LOG_LEVEL 0
Nota
You can configure some aspects of QGIS server by setting environment variables. For example, to set QGIS server on Apache to use /path/to/config/QGIS/QGIS2.ini settings file, add to Apache config:
SetEnv QGIS_OPTIONS_PATH "/path/to/config/"
or, if using fcgi:
FcgidInitialEnv QGIS_OPTIONS_PATH "/path/to/config/"
This is a list of the variables supported by QGIS server:
A number of elements have both a <Name> and a <Title>. The Name is a text string used for machine-to-machine communication while the Title is for the benefit of humans.
For example, a dataset might have the descriptive Title “Maximum Atmospheric Temperature” and be requested using the abbreviated Name “ATMAX”. User can already set title for layers, groups and project.
OWS name is based on the name used in layer tree. This name is more a label for humans than a name for machine-to-machine communication.
QGIS Server supports:
short name line edits to layers properties You can change this by right clicking on a layer, choose Properties ‣ Metadata tab ‣ Description ‣ Short name.
WMS data dialog to layer tree group (short name, title, abstract)
By right clicking on a layer group and selecting the Set Group WMS data option you will get:
Set group WMS data dialog
short name line edits to project properties - add a regexp validator "^[A-Za-z][A-Za-z0-9\._-]*" to short name line edit accessible through a static method
add a regexp validator "^[A-Za-z][A-Za-z0-9\._-]*" to short name line edit accessible through a static method
You can choose a short name for the project root by going to Project properties ‣ OWS Server ‣ Service capabilities ‣ Short name.
add a TreeName element in the fullProjectSettings
If a short name has been set for layers, groups or project it is used by QGIS Sever as the layer name.
In order to make apache aware of the PostgreSQL service file (see the File per la connessione a Servizio PostgreSQL section) you need to make your *.conf file look like:
SetEnv PGSERVICEFILE /home/web/.pg_service.conf
<Directory "/home/web/apps2/bin/">
AllowOverride None
.....
Keep in mind that you may use QGIS projects that point to fonts that may not exist by default on other machines. This means that if you share the project, it may look different on other machines (if the fonts don’t exist on the target machine).
In order to ensure this does not happen you just need to install the missing fonts on the target machine. Doing this on desktop systems is usually trivial (double clicking the fonts).
For linux, if you don’t have a desktop environment installed (or you prefer the command line) you need to:
On Debian based systems:
$ sudo su
$ mkdir -p /usr/local/share/fonts/truetype/myfonts && cd /usr/local/share/fonts/truetype/myfonts
# copy the fonts from their location
$ cp /fonts_location/* .
$ chown root *
$ cd .. && fc-cache -f -v
On Fedora based systems:
$ sudo su
$ mkdir /usr/share/fonts/myfonts && cd /usr/share/fonts/myfonts
# copy the fonts from their location
$ cp /fonts_location/* .
$ chown root *
$ cd .. && fc-cache -f -v