In: https://wiki.openstreetmap.org/wiki/Overpass_API/Installation I can read: Setting up the Web API only for apache. Is it possible for Nginx?
I am trying it but I always find 405 Not Allowed if I ask remotely
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8000;
location /api/ {
alias /mnt/data/openstreetmap/osm-3s_v0.7.4/cgi-bin/;
}
#
location /cgi-bin/ {
gzip off;
root /mnt/data/openstreetmap/osm-3s_v0.7.4/;
fastcgi_read_timeout 900;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include /opt/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location / {
root /mnt/data/openstreetmap/osm-3s_v0.7.4/html;
index index.html index.htm;
}
}
}
In localhost:
wget --output-document=test.xml http://localhost:8000/api/interpreter?data=%3Cprint%20mode=%22body%22/%3E
--2016-08-14 18:07:38-- http://localhost:8000/api/interpreter?data=%3Cprint%20mode=%22body%22/%3E Petición HTTP enviada, esperando respuesta... 200 OK Longitud: 1983984 (1,9M) [application/octet-stream] Grabando a: “test.xml”
test.xml 100%[======================================================================>] 1,89M --.-KB/s in 0,004s
2016-08-14 18:07:38 (488 MB/s) - “test.xml” guardado [1983984/19839
In browser (remote client): 405 Not Allowed
No problem with access to index.html
write this
rewrite ^/api/(.+)$ /cgi-bin/$1 last;
instead of
location /api/ {
alias /mnt/data/openstreetmap/osm-3s_v0.7.4/cgi-bin/;
}