-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhost.conf
82 lines (68 loc) · 2.62 KB
/
host.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
server {
# We're behind a reverse proxy so we only listen on port 80.
listen 80;
resolver 127.0.0.11; # helps it resolve "mapproxy" which is a docker
location /500 {
return 500;
}
### precincts
# Static content for precinct PDF documents, see also both volume entries... precinct PDFs and precinct thumbnails
# Since the precinct docs are PDFs I don't have a convenient way
# to generate them on the fly yet.
location /precincts/ {
root /srv;
autoindex on;
}
location /precinct_tn/ {
root /srv;
autoindex on;
}
# Perhaps I should update the popup code to use this instead
#location /precincts/tn/ {
# root /srv;
# autoindex on;
#}
#### bridges and waterways
# Rewriting URLS to change simple IDs into complete URLs.
# In your app, you can use either the plain ID from the attribute field
# or the complete photo filename (see next section), it does not matter.
# All bridge photos have a number (3 or 4 digit) followed by a single uppercase letter
location ~ \/photos\/(tn\/)?bridges/(\d+[A-Z])$ {
# either of these returns works, the second is simpler
# return 301 https://$host/photos/$1bridges/$2.jpg;
return 301 https://$host$request_uri.jpg;
}
# All waterway photos have a number only
location ~ \/photos\/(tn\/)?waterway\/(\d+)$ {
return 301 https://$host/photos/$1waterway/ph$2.png;
}
# Serve the actual bridges/ and waterway/ photos (full names) here.
location /photos {
alias /srv/img;
error_page 404 415 =200 /photos/static/no_photo_available.png;
}
# Generate thumbnails on the fly.
location /photos/tn {
alias /srv/img; # Serve the same images, but shrink them
image_filter resize 220 150;
image_filter_buffer 100m; # Avoid "too big" errors.
error_page 404 415 =200 /photos/static/no_photo_available.png;
}
# All other static content is here, including the "no photo" image.
# It's a volume, so no restart should be needed.
location /photos/static {
alias /srv/static;
autoindex on;
}
### mapproxy -- everything else...
location / {
# This fails because "mapproxy" only resolves internally.
#return 301 http://mapproxy:8080$request_uri;
# This works because traffic passes through this nginx.
proxy_pass http://mapproxy:8080;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Script-Name "/mapproxy";
# error_page 404 415 =200 /photos/static/no_photo_available.png;
}
}