1 map $uri $nominatim_script_name {
7 map $uri $nominatim_path_info {
11 map $query_string $email_id {
12 ~(^|&)email=([^&]+) $2;
15 upstream nominatim_service {
16 server 127.0.0.1:<%= @pools[:www][:port ]%>;
22 2001:978:2:2c::172:6 0;
23 2001:978:2:2c::172:7 0;
24 2001:978:2:2c::172:8 0;
25 2001:978:2:2c::172:b 0;
26 2001:978:2:2c::172:c 0;
27 2001:978:2:2c::172:d 0;
39 map $http_user_agent $blocked_user_agent {
41 include <%= @confdir %>/nginx_blocked_user_agent.conf;
44 map $http_referer $blocked_referrer {
46 include <%= @confdir %>/nginx_blocked_referrer.conf;
49 map $limit $limit_key {
51 1 $binary_remote_addr;
54 map $blocked_user_agent $limit_tarpit {
56 1 $binary_remote_addr;
57 2 $binary_remote_addr;
60 limit_req_zone $limit zone=www:50m rate=2r/s;
61 limit_req_zone $limit_tarpit zone=tarpit:10m rate=1r/s;
62 limit_req_zone $binary_remote_addr zone=blocked:10m rate=20r/m;
66 listen 80 deferred backlog=16384 reuseport fastopen=2048 default_server;
67 listen 443 ssl deferred backlog=16384 reuseport fastopen=2048 http2 default_server;
69 listen [::]:80 deferred backlog=16384 reuseport fastopen=2048 default_server;
70 listen [::]:443 ssl deferred backlog=16384 reuseport fastopen=2048 http2 default_server;
71 server_name localhost;
73 ssl_certificate /etc/ssl/certs/<%= node[:fqdn] %>.pem;
74 ssl_certificate_key /etc/ssl/private/<%= node[:fqdn] %>.key;
76 root <%= @directory %>/website;
79 access_log <%= node[:nominatim][:logdir] %>/nominatim.openstreetmap.org-access.log combined;
80 error_log <%= node[:nominatim][:logdir] %>/nominatim.openstreetmap.org-error.log;
82 location /nginx_status {
90 error_page 403 /403.html;
92 limit_req zone=blocked burst=5;
95 error_page 429 /509.html;
97 limit_req zone=blocked burst=5;
101 set $anyid $http_referer$http_user_agent$email_id;
104 if ($blocked_user_agent ~ ^2$)
106 if ($blocked_referrer)
109 try_files $uri $uri/ @php;
113 limit_req zone=www burst=10;
114 limit_req zone=tarpit burst=2;
115 limit_req_status 429;
116 fastcgi_pass nominatim_service;
117 include fastcgi_params;
118 fastcgi_param QUERY_STRING $args;
119 fastcgi_param PATH_INFO "$nominatim_path_info";
120 fastcgi_param SCRIPT_FILENAME "$document_root/$nominatim_script_name";
124 limit_req zone=www burst=10;
125 limit_req zone=tarpit burst=2;
126 limit_req_status 429;
127 fastcgi_pass nominatim_service;
128 include fastcgi_params;
129 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;