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 <% @frontends.each do |frontend| -%>
23 <% frontend.ipaddresses(:role => :external) do |address| -%>
33 map $http_user_agent $blocked_user_agent {
35 include <%= @confdir %>/nginx_blocked_user_agent.conf;
38 map $http_referer $blocked_referrer {
40 include <%= @confdir %>/nginx_blocked_referrer.conf;
43 map $whitelisted $limit_www {
45 0 $binary_remote_addr;
48 map $blocked_user_agent $limit_tarpit {
50 1 $binary_remote_addr;
51 2 $binary_remote_addr;
54 limit_req_zone $limit_www zone=www:50m rate=2r/s;
55 limit_req_zone $limit_tarpit zone=tarpit:10m rate=1r/s;
56 limit_req_zone $binary_remote_addr zone=blocked:10m rate=20r/m;
60 listen 80 deferred backlog=16384 reuseport fastopen=2048 default_server;
61 listen 443 ssl deferred backlog=16384 reuseport fastopen=2048 http2 default_server;
63 listen [::]:80 deferred backlog=16384 reuseport fastopen=2048 default_server;
64 listen [::]:443 ssl deferred backlog=16384 reuseport fastopen=2048 http2 default_server;
65 server_name localhost;
67 ssl_certificate /etc/ssl/certs/<%= node[:fqdn] %>.pem;
68 ssl_certificate_key /etc/ssl/private/<%= node[:fqdn] %>.key;
70 root <%= @directory %>/website;
73 access_log <%= node[:nominatim][:logdir] %>/nominatim.openstreetmap.org-access.log combined;
74 error_log <%= node[:nominatim][:logdir] %>/nominatim.openstreetmap.org-error.log;
76 location /nginx_status {
84 error_page 403 /403.html;
86 limit_req zone=blocked burst=5;
89 error_page 429 /509.html;
91 limit_req zone=blocked burst=5;
95 set $anyid $http_referer$http_user_agent$email_id;
98 if ($blocked_user_agent ~ ^2$)
100 if ($blocked_referrer)
103 try_files $uri $uri/ @php;
107 limit_req zone=www burst=10;
108 limit_req zone=tarpit burst=2;
109 limit_req_status 429;
110 fastcgi_pass nominatim_service;
111 include fastcgi_params;
112 fastcgi_param QUERY_STRING $args;
113 fastcgi_param PATH_INFO "$nominatim_path_info";
114 fastcgi_param SCRIPT_FILENAME "$document_root/$nominatim_script_name";
118 limit_req zone=www burst=10;
119 limit_req zone=tarpit burst=2;
120 limit_req_status 429;
121 fastcgi_pass nominatim_service;
122 include fastcgi_params;
123 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;