+upstream nominatim_service {
+ server 127.0.0.1:<%= @pools[:www][:port ]%>;
+}
+
map $uri $nominatim_script_name {
~^(.+?\.php) $1;
~^/([^/]+) $1.php;
~(^|&)email=([^&]+) $2;
}
-upstream nominatim_service {
- server 127.0.0.1:<%= @pools[:www][:port ]%>;
+map $email_id $missing_email {
+ default "";
+ "" 1;
+}
+
+map $http_user_agent $missing_ua {
+ default "";
+ "" 1;
+}
+
+map $http_referer $missing_referer {
+ default "";
+ "" 1;
}
# Whitelisted IPs
8.43.85.23 1; # gnome
}
-map $http_user_agent $blocked_user_agent {
+map $missing_email$missing_referer$http_user_agent $blocked_user_agent {
default 0;
+ "11" 2; # block any requests without identifier
include <%= @confdir %>/nginx_blocked_user_agent.conf;
}
-map $http_referer $blocked_referrer {
+map $missing_email$missing_ua$http_referer $blocked_referrer {
default 0;
include <%= @confdir %>/nginx_blocked_referrer.conf;
}
+map $missing_referer$missing_ua$email_id $blocked_email {
+ default 0;
+ include <%= @confdir %>/nginx_blocked_email.conf;
+}
+
map $whitelisted $limit_www {
1 "";
0 $binary_remote_addr;
limit_req_zone $binary_remote_addr zone=blocked:10m rate=20r/m;
server {
- listen 80 default_server;
- listen [::]:80 default_server;
+ listen 80 default_server;
+ listen [::]:80 default_server;
- location /nginx_status {
+ access_log <%= node[:nominatim][:logdir] %>/nominatim.openstreetmap.org-access.log combined;
+ error_log <%= node[:nominatim][:logdir] %>/nominatim.openstreetmap.org-error.log;
+
+ location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
- rewrite ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 permanent;
+ rewrite ^/\.well-known/acme-challenge/(.*)$ http://acme.openstreetmap.org/.well-known/acme-challenge/$1 permanent;
- location / {
- return 301 https://$host$request_uri;
- }
+ location / {
+ return 301 https://$host$request_uri;
+ }
}
server {
}
location / {
- set $anyid $http_referer$http_user_agent$email_id;
- if ($anyid = "")
- { return 403; }
if ($blocked_user_agent ~ ^2$)
{ return 403; }
if ($blocked_referrer)
{ return 403; }
+ if ($blocked_email)
+ { return 403; }
try_files $uri $uri/ @php;
}