Important
Traducerea este un efort al comunității, la care puteți să vă alăturați. În prezent, această pagină este tradusă 43.52%.
6. Configurare avansată
6.1. Jurnalizarea
To log requests sent to the server, you have to set the following environment variable:
With the following variables the logging can be further customized:
6.2. Variabile de mediu
You can configure some aspects of QGIS Server by setting environment variables.
According to the HTTP server and how you run QGIS Server, there are several ways to define these variables. This is fully described in Server HTTP Apache.
Name & Description |
Implicit |
Servicii |
|---|---|---|
|
«» |
All |
|
«» |
All |
|
«» |
All |
|
«» |
WMS |
|
depends on packaging |
OAPIF/WFS3 |
|
QGIS3 server |
All |
|
10000 |
OAPIF/WFS3 |
|
|
All |
|
50 MB |
All |
|
40 |
All |
|
false |
WMS |
|
false |
All |
|
false |
All |
|
„” |
All |
|
„” |
All |
|
„” |
All |
|
«» |
All |
|
0 |
All |
|
false |
All |
|
false |
All |
|
-1 |
All |
|
«» |
All |
|
false |
WMS |
|
All |
|
|
filesystem |
All |
|
«» |
All |
|
false |
WMS |
|
false |
All |
|
«» |
WCS |
|
«» |
WFS |
|
-1 |
WMS |
|
«» |
WMS |
|
«» |
WMTS |
|
«» |
All |
6.3. Settings summary
When QGIS Server is starting, you have a summary of all configurable parameters thanks to environment variables. Moreover, the value currently used and the origin is also displayed.
For example with spawn-fcgi:
export QGIS_OPTIONS_PATH=/home/user/.local/share/QGIS/QGIS3/profiles/default/
export QGIS_SERVER_LOG_STDERR=1
export QGIS_SERVER_LOG_LEVEL=2
spawn-fcgi -f /usr/lib/cgi-bin/qgis_mapserv.fcgi -s /tmp/qgisserver.sock -U www-data -G www-data -n
QGIS Server Settings:
- QGIS_OPTIONS_PATH / '' (Override the default path for user configuration): '/home/user/.local/share/QGIS/QGIS3/profiles/default/' (read from ENVIRONMENT_VARIABLE)
- QGIS_SERVER_PARALLEL_RENDERING / '/qgis/parallel_rendering' (Activate/Deactivate parallel rendering for WMS getMap request): 'true' (read from INI_FILE)
- QGIS_SERVER_MAX_THREADS / '/qgis/max_threads' (Number of threads to use when parallel rendering is activated): '4' (read from INI_FILE)
- QGIS_SERVER_LOG_LEVEL / '' (Log level): '2' (read from ENVIRONMENT_VARIABLE)
- QGIS_SERVER_LOG_STDERR / '' (Activate/Deactivate logging to stderr): '1' (read from ENVIRONMENT_VARIABLE)
- QGIS_PROJECT_FILE / '' (QGIS project file): '' (read from DEFAULT_VALUE)
- MAX_CACHE_LAYERS / '' (Specify the maximum number of cached layers): '100' (read from DEFAULT_VALUE)
- QGIS_SERVER_CACHE_DIRECTORY / '/cache/directory' (Specify the cache directory): '/root/.local/share/QGIS/QGIS3/profiles/default/cache' (read from DEFAULT_VALUE)
- QGIS_SERVER_CACHE_SIZE / '/cache/size' (Specify the cache size): '52428800' (read from INI_FILE)
Ini file used to initialize settings: /home/user/.local/share/QGIS/QGIS3/profiles/default/QGIS/QGIS3.ini
In this particular case, we know that QGIS_SERVER_MAX_THREADS and QGIS_SERVER_PARALLEL_RENDERING values are read from the ini file found in QGIS_OPTIONS_PATH directory (which is defined through an environment variable). The corresponding entries in the ini file are /qgis/max_threads and /qgis/parallel_rendering and their values are true and 4 threads.
6.4. Connection to service file
In order to make apache aware of the PostgreSQL service file (see the
PostgreSQL Service connection file section) you need to make
your *.conf file look like:
SetEnv PGSERVICEFILE /home/web/.pg_service.conf
<Directory "/home/web/apps2/bin/">
AllowOverride None
.....
6.5. Add fonts to your linux server
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