-
Notifications
You must be signed in to change notification settings - Fork 1
/
nginx.conf.template
122 lines (101 loc) · 3.78 KB
/
nginx.conf.template
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
# Based on: https://raw.githubusercontent.com/cloudfoundry/nginx-buildpack/v1.0.3/fixtures/mainline/nginx.conf
# Only difference between test and prouction configuration is the use of 2 iiif_image hosts
worker_processes auto;
worker_rlimit_nofile 4096;
daemon off;
error_log stderr warn;
events {
use epoll;
worker_connections 4096;
multi_accept on;
}
http {
charset utf-8;
default_type application/octet-stream;
include mime.types;
sendfile on;
# EA-2236: Disable access logs
access_log off;
tcp_nodelay on;
tcp_nopush on;
keepalive_timeout 90s;
keepalive_requests 100;
types_hash_max_size 2048;
upstream iiif_image {
keepalive 15;
# Definition of image server host.
server ${PROXY_IMAGE_HOST};
# HACK: we can add an additional host here, but need to set that variable to "server <hostname>;"
${PROXY_IMAGE_HOST2}
}
upstream iiif_presentation_manifest {
keepalive 25;
server ${MANIFEST_API_HOST};
}
upstream iiif_presentation_fulltext {
keepalive 25;
server ${FULLTEXT_API_HOST};
}
include nginx.conf.d/http-server-*.conf;
server {
listen 80;
root public;
index index.html;
add_header 'Access-Control-Allow-Origin' '*' always;
resolver ${RESOLVER_SETTINGS};
location / {
include nginx.conf.d/location-cors.conf;
}
# Redirect root
location = / {
return 302 ${ROOT_REDIRECT_URL};
}
# Used by Kubernetes health checks
location /nginx-health {
default_type application/json;
return 200 '{"status":"healthy"}';
}
# IIIF Image (uses servers in upstream section)
location ~ ^/image/([A-Z0-9]+)/([^/]+)/([^/]+)/(.*) {
# For production we need to specifically set a proper public server name (see also EA-3444)
proxy_set_header Host ${SERVER_NAME};
proxy_pass http://iiif_image/records/$1/representations/$2/versions/$3/files/$4;
}
location ~ ^/(records|data-providers)/(.*) {
# For production we need to specifically set a proper public server name (see also EA-3444)
proxy_set_header Host ${SERVER_NAME};
proxy_pass http://iiif_image/$1/$2;
}
# IIIF Presentation: Manifest
location ~ ^/presentation/(.*)/manifest {
gzip_types *;
proxy_set_header Host ${MANIFEST_API_HOST};
if ($arg_wskey != "") {
proxy_pass http://iiif_presentation_manifest/presentation/$1/manifest$is_args$args;
}
if ($arg_wskey = "") {
proxy_pass http://iiif_presentation_manifest/presentation/$1/manifest?wskey=${API_KEY}&$args;
}
}
# IIIF Presentation: Fulltext within-issue search
location ~ ^/presentation/(.*)/search {
gzip_types *;
# handle whitespaces in search query (see EA-2276)
rewrite ^/presentation/(.*)/search$ /presentation/$1/search break;
proxy_set_header Host ${FULLTEXT_API_HOST};
proxy_pass http://iiif_presentation_fulltext;
}
# IIIF Presentation: Fulltext summary
location ~ ^/presentation/(.*)/annopage$ {
gzip_types *;
proxy_set_header Host ${FULLTEXT_API_HOST};
proxy_pass http://iiif_presentation_fulltext/presentation/$1/annopage$is_args$args;
}
# IIIF Presentation: Fulltext annotation and annopages
location ~ ^/presentation/(.*)/(anno|annopage)/([^/]*)$ {
gzip_types *;
proxy_set_header Host ${FULLTEXT_API_HOST};
proxy_pass http://iiif_presentation_fulltext/presentation/$1/$2/$3$is_args$args;
}
}
}