Skip to content
Browse files

[RPM] Add support for HDF5

[RPM] Do not make qgis-server depend on httpd
[RPM] Add an Nginx configuration example
[RPM] Update server readme and replace wms with a better ogc
[RPM] More fixes for Epoch directive
[RPM] F27 reached EoL, replace it with F29
[RPM] Add support for netcdf and replace ogc with ows as server endpoint
[RPM] Add sample systemd service file
  • Loading branch information
daniviga committed Dec 14, 2018
1 parent 9e5bb36 commit a79499204420792ebb70a6b33abfc9aa732c9052
@@ -10,10 +10,10 @@ OUTDIR="result/"

# Which arches to build for. Check /etc/mock for possible options

# Which git branch to export. Normally take the current
@@ -12,16 +12,18 @@
# py files located under /usr/share/qgis/python/plugins
%global __python %{__python3}

%define grass grass74

%if %{_timestamp} > 0
# Epoch is set only when building packages from master
Epoch: %{_timestamp}
%define combinedversion %{epoch}:%{version}
%define builddate %(date -d @%{_timestamp} '+%a %b %d %Y')
%define combinedversion %{version}
%define builddate %(date '+%a %b %d %Y')

%define grass grass74

Name: qgis
Version: %{_version}
Release: %{_relver}%{?dist}
@@ -33,12 +35,15 @@ URL:

# Sample configuration files for QGIS server
Source2: %{name}-server-httpd.conf
Source4: %{name}-server-README.fedora
Source1: %{name}-server-httpd.conf
Source2: %{name}-server-nginx.conf
Source3: %{name}-server-fcgi.socket
Source4: %{name}-server-fcgi.service
Source5: %{name}-server-README.fedora

# MIME definitions
# Based on debian/qgis.xml but excluding already defined or proprietary types
Source5: %{name}-mime.xml
Source6: %{name}-mime.xml

# Fix builds on 64-bit machines
@@ -69,6 +74,8 @@ BuildRequires: gsl-devel
BuildRequires: libzip-devel
BuildRequires: postgresql-devel
BuildRequires: sqlite-devel
BuildRequires: hdf5-devel
BuildRequires: netcdf-devel
BuildRequires: fcgi-devel

# OpenCL
@@ -131,14 +138,14 @@ and USGS ASCII DEM.

%package devel
Summary: Development Libraries for the QGIS
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}%{?_isa} = %{combinedversion}-%{release}

%description devel
Development packages for QGIS including the C header files.

%package grass
Summary: GRASS Support Libraries for QGIS
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}%{?_isa} = %{combinedversion}-%{release}

# The plug-in requires more than just the grass-libs.
# This questions the sense of the libs package.
@@ -153,12 +160,12 @@ GRASS plugin for QGIS required to interface with the GRASS system.
%package -n python3-qgis
%{?python_provide:%python_provide python3-qgis}
# Remove before F30
Provides: %{name}-python = %{version}-%{release}
Provides: %{name}-python%{?_isa} = %{version}-%{release}
Provides: %{name}-python = %{combinedversion}-%{release}
Provides: %{name}-python%{?_isa} = %{combinedversion}-%{release}
Obsoletes: %{name}-python < %{version}-%{release}
Obsoletes: python2-%{name} < %{version}-%{release}
Summary: Python integration and plug-ins for QGIS
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}%{?_isa} = %{combinedversion}-%{release}
Requires: gdal-python3
Requires: python3-future
Requires: python3-jinja2
@@ -176,16 +183,15 @@ Python integration and plug-ins for QGIS.

%package server
Summary: FCGI-based OGC web map server
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Requires: mod_fcgid
Requires: %{name}%{?_isa} = %{combinedversion}-%{release}
Provides: mapserver = %{version}-%{release}
Obsoletes: mapserver < 2.8.1-1

%description server
This FastCGI OGC web map server implements OGC WMS 1.3.0 and 1.1.1.
The services are prepared as regular projects in QGIS. They're rendered using
the QGIS libraries. The server also supports SLD (Styled Layer Descriptor)
for styling. Sample configurations for Httpd and Lighttpd are included.
for styling. Sample configurations for HTTPD and Nginx are included.

Please refer to %{name}-server-README.fedora for details!

@@ -196,8 +202,12 @@ Please refer to %{name}-server-README.fedora for details!
# Remove executable permissions from source code files
find . \( -name "*.cpp" -o -name "*.h" \) -type f -perm /111 -execdir chmod -x {} \+

# Readme file for QGIS server configuration and Lighttpd example
# Readme file for QGIS server configuration HTTPD and Nginx example
install -pm0644 %{SOURCE1} .
install -pm0644 %{SOURCE2} .
install -pm0644 %{SOURCE3} .
install -pm0644 %{SOURCE4} .
install -pm0644 %{SOURCE5} .

gzip ChangeLog

@@ -228,14 +238,9 @@ make install DESTDIR=%{buildroot}

# Install MIME type definitions
install -d %{buildroot}%{_datadir}/mime/packages
install -pm0644 %{SOURCE5} \
install -pm0644 %{SOURCE6} \

# Install basic QGIS Mapserver configuration for Apache
install -pd %{buildroot}%{_sysconfdir}/httpd/conf.d
install -pm0644 %{SOURCE2} \

# See qgis-server-README.fedora
rm -f %{buildroot}%{_libexecdir}/%{name}/wms_metadata.xml
rm -f %{buildroot}%{_libexecdir}/%{name}/admin.sld
@@ -328,7 +333,7 @@ update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || :

%files server
%doc src/server/admin.sld src/server/wms_metadata.xml %{name}-server-README.fedora
%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}-server.conf
%doc %{name}-server-httpd.conf %{name}-server-nginx.conf %{name}-server-fcgi.socket %{name}-server-fcgi.service
@@ -7,18 +7,21 @@ Services (WMS). Simply layout your map in QGIS. The WMS will look
exactly the same, because QGIS server uses the same libraries for
rendering, as the desktop application does.

A sample configuration file for Httpd is installed under
A sample configuration file for HTTPD is installed under
Also a sample configuration file for Nginx is available under
/usr/share/doc/qgis-server/qgis-server-nginx.conf with the corresponding
systemd socket for the FastCGI daemon.

This configuration expects QGIS project files under /var/www/wms. To
This configuration expects QGIS project files under /var/www/ows. To
use it, reload the Httpd configuration and place the files you want to
publish in this directory.

A getCapabilities request looks like this:


QGIS project is "/var/www/wms/my_qgis_project.qgs". The sample
QGIS project is "/var/www/ows/my_qgis_project.qgs". The sample
configuration automatically adds the project file extension for you.

The actual data can stay where it is. Make sure QGIS server can
@@ -55,7 +58,8 @@ Both configuration files are included as documentation.


Further information:

Volker Fröhlich

Daniele Viganò
@@ -0,0 +1,17 @@
# Adapted from
# Path: /etc/systemd/system/qgis-server-fcgi.service
# systemctl enable qgis-server-fcgi.service && systemctl start qgis-server-fcgi.service

Description = QGIS Server Tracker FastCGI backend
After = qgis-server-fcgi.socket

# An existing user must be set
User = qgis
Group = qgis
ExecStart = /usr/libexec/qgis/qgis_mapserv.fcgi
StandardInput = socket
WorkingDirectory = /tmp

Restart = always
@@ -0,0 +1,14 @@
# Adapted from
# Path: /etc/systemd/system/qgis-server-fcgi.socket
# systemctl enable qgis-server-fcgi.socket && systemctl start qgis-server-fcgi.socket

Description = QGIS Server FastCGI Socket
PartOf = qgis-server-fcgi.service

ListenStream =
Accept = yes

WantedBy =
@@ -2,7 +2,7 @@
# It is not meant for productive use.

RewriteEngine on
RewriteRule ^/wms/(.*)$ /qgis/qgis_mapserv.fcgi?map=/var/www/wms/$1.qgs [QSA,PT]
RewriteRule ^/ows/(.*)$ /qgis/qgis_mapserv.fcgi?map=/var/www/ows/$1.qgs [QSA,PT]

ScriptAlias /qgis/ "/usr/libexec/qgis/"

@@ -0,0 +1,78 @@
# Adapted from
# It requires a FCGI processes spawner like spawn-fcgi or systemd (see s-server-fcgi.socket)

user nginx;
worker_processes auto;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
pid /run/;

events {
worker_connections 1024;

http {

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;

include /etc/nginx/mime.types;
default_type application/octet-stream;

# Get 'port' from `$http_host`
map $http_host $port {
"~*.*:(?<p>.*)" $p;
default server_port;
# Get 'proto' from `$scheme` unless 'X-Forwarded-Proto'
# is set by the reverse proxy
map $http_x_forwarded_proto $qgis_proto {
"" $scheme;
default $http_x_forwarded_proto;
# Get 'host' from `$host` unless 'X-Forwarded-Host'
# is set by the reverse proxy
map $http_x_forwarded_host $qgis_host {
"" $host;
default $http_x_forwarded_host;
# Get 'port' from `$port` unless 'X-Forwarded-Port'
# is set by the reverse proxy
map $http_x_forwarded_port $qgis_port {
"" $port;
default $http_x_forwarded_port;

server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;

location /ows/ {
rewrite ^/ows/(.*)$ /qgis/qgis_mapserv.fcgi?map=/var/www/ows/$1.qgs;
location /qgis/ {
internal; # Used only by the OGC rewrite
root /var/www/ows;
fastcgi_pass localhost:9993;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
# build links in GetCapabilities based on
# the hostname exposed by the reverse proxy
fastcgi_param SERVER_PROTOCOL $qgis_proto;
fastcgi_param SERVER_NAME $qgis_host;
fastcgi_param SERVER_PORT $qgis_port;
error_page 404 /404.html;
location = /40x.html {
error_page 500 502 503 504 /50x.html;
location = /50x.html {


0 comments on commit a794992

Please sign in to comment.
You can’t perform that action at this time.