-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qgis-server-nginx.conf
123 lines (109 loc) · 4.23 KB
/
qgis-server-nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# oq-qgis-server
# Copyright (C) 2018-2019 GEM Foundation
#
# oq-qgis-server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# oq-qgis-server is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
user www-data;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /tmp/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
proxy_temp_path /tmp/proxy_temp;
client_body_temp_path /tmp/client_temp;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
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 'host' from `$host` unless 'X-Forwarded-Host'
# is set by the reverse proxy.
# 'X-Forwarded-Host' may contain also the port,
# so it is removed from the variable
map $http_x_forwarded_host $qgis_host {
"~(?<h>[^:]+)" $h;
default $host;
}
# Get 'PORT' from `$http_host`
map $http_host $port {
"~*.*:(?<p>.*)" $p;
default $server_port;
}
# Get 'HTTPS' status from `$https` unless 'X-Forwarded-Proto'
# is set by the reverse proxy and contains 'https' scheme
map $http_x_forwarded_proto $qgis_ssl {
"https" "on";
default $https;
}
# 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 8080 default_server;
listen [::]:8080 default_server;
server_name _;
root /usr/share/nginx/html;
location /ows/wfs3/ {
rewrite ^/ows/wfs3/([^/]*)/(.*)$ /qgis/qgis_mapserv.fcgi/wfs3/$2?map=/io/data/$1.qgs;
}
location /ows/ {
rewrite ^/ows/(.*)$ /qgis/qgis_mapserv.fcgi?map=/io/data/$1.qgs;
}
location /qgis/ {
internal; # Used only by the OGC rewrite
root /var/www/data;
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 HTTPS $qgis_ssl;
fastcgi_param SERVER_NAME $qgis_host;
fastcgi_param SERVER_PORT $qgis_port;
# QGIS Server related configuration (prevent auxilary file loading)
fastcgi_param GDAL_DISABLE_READDIR_ON_OPEN "EMPTY_DIR";
fastcgi_param OGR_SQLITE_JOURNAL "DELETE";
# QGIS Server related configuration (Cache Busting)
fastcgi_param CPL_VSIL_CURL_NON_CACHED "/vsicurl/http://rails-web:8443/:/vsicurl/http://rails:8443/";
fastcgi_param CPL_VSIL_CURL_CACHE_SIZE 0;
# Timezone for postgres connection
fastcgi_param PGTZ "UTC";
include fastcgi_params;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}