[英]Overpass API with nginx
在: https : //wiki.openstreetmap.org/wiki/Overpass_API/Installation我可以阅读:仅为apache设置Web API。 Nginx有可能吗?
我正在尝试但如果我远程询问,我总是会发现405不允许
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;
}
}
}
在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 /% 3EPeticiónHTTPenviada,esperando respuesta ... 200 OK Longitud:1983984(1,9M)[application / octet-stream] Grabando a:“test.xml”
test.xml 100%[============================================ ==========================>] 1,800M - .- KB / s在0,004s
2016-08-14 18:07:38(488 MB / s) - “test.xml”guardado [1983984/19839
在浏览器(远程客户端)中: 405 Not Allowed
访问index.html没问题
写这个
rewrite ^/api/(.+)$ /cgi-bin/$1 last;
代替
location /api/ {
alias /mnt/data/openstreetmap/osm-3s_v0.7.4/cgi-bin/;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.