-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
108 lines (91 loc) · 4.06 KB
/
nginx.conf
File metadata and controls
108 lines (91 loc) · 4.06 KB
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
server {
# Default virtual server
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name _;
server_tokens off;
charset utf-8;
gzip on;
sendfile on;
tcp_nopush on;
error_log /var/www/data_dir/logs/error.log error;
access_log /var/www/data_dir/logs/access.log;
root /var/www/public;
error_page 404 /mapserver/web/40x.html;
error_page 500 502 503 504 /mapserver/web/50x.html;
index index.php index.html index.htm;
# Serve static files from public folder
location / {
# Redirect all requests to /mapserver/web/
rewrite ^/$ /mapserver/web/ permanent;
try_files $uri $uri/ =404;
}
location /mapserver/ {
# Fix missing QUERY_STRING params
rewrite ^/mapserver/(ows)$ /mapserver/$1?map=default last;
rewrite ^/mapserver/(wms|wfs|wcs)$ /mapserver/$1?map=default&SERVICE=$1 last;
rewrite ^/mapserver/([a-zA-Z0-9\-\_]+)/(ows)$ /mapserver/$1/$2?map=$1 last;
rewrite ^/mapserver/([a-zA-Z0-9\-\_]+)/(wms|wfs|wcs)$ /mapserver/$1/$2?map=$1&SERVICE=$2 last;
rewrite ^/mapserver/(ogcapi)(.*)$ /mapserver/default/$1$2 permanent;
# Redirect to client if url is empty
rewrite ^/mapserver/$ /mapserver/web/ permanent;
}
# Serve virtual resources with index.php
location ~ ^/mapserver/rest/(.*)/?$ {
try_files $uri /mapserver/rest/index.php?$is_args$args;
}
# Serve virtual resources with index.html
location ~ ^/mapserver/web/(.*)/?$ {
try_files $uri /mapserver/web/index.html;
}
# Deny access to hidden files like .htaccess and .git
location ~ /\. {
log_not_found off;
deny all;
}
# Serve PHP scripts with PHP-FPM
location ~ [^/]\.php(/|$) {
gzip off;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_param HTTP_PROXY "";
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
include fastcgi.conf;
}
# Serve pregenerated tiles with MapCache module
location ~ ^/mapserver/cache/service(?<path_info>/.*|$) {
set $url_prefix "/mapserver/cache/service";
mapcache /var/www/data_dir/mapcache.xml;
error_page 404 = @fastcgi_mapcache;
}
# Handle tile generation on cache miss (MapCache module can't handle this, so we use here fastCGI)
location @fastcgi_mapcache {
fastcgi_param MAPCACHE_CONFIG_FILE /var/www/data_dir/mapcache.xml;
fastcgi_param SCRIPT_FILENAME /usr/bin/mapcache.fcgi;
fastcgi_param PATH_INFO $path_info;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi.conf;
}
# Pass OGC Web Service requests to MapServer
location ~ ^/mapserver(?>/(?<ms_mapfile>(?!web|api|cache)[a-zA-Z0-9\-\_]+))?/(?<service>ows|wms|wfs|wcs)$ {
gzip off;
fastcgi_param MAPSERVER_CONFIG_FILE /var/www/data_dir/mapserver.conf;
fastcgi_param SCRIPT_FILENAME /usr/bin/mapserv;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi.conf;
}
# Pass OGC API requests to MapServer
location ~ ^/mapserver(?<path_info>/(?>(?!web|api|cache)[a-zA-Z0-9\-\_]+)/ogcapi(?>/.*|$))$ {
gzip off;
fastcgi_param MAPSERVER_CONFIG_FILE /var/www/data_dir/mapserver.conf;
fastcgi_param SCRIPT_FILENAME /usr/bin/mapserv;
fastcgi_param PATH_INFO $path_info;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi.conf;
}
# Proxying requests to an external GeoServer service
# ...
}