是否有可能只是反向代理被褥,而不暴露CouchDB的根和RESTful API? 我有以下的nginxconfiguration:
server { # This should never be hit, as the port isn't open, # but it's here for completeness sake listen 80; return 301 https://$host$request_uri; } server { listen 443; server_name my_futon_host; ssl_certificate /path/to/my/certificate.pem; ssl_certificate_key /path/to/my/private.key; ssl on; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; ssl_prefer_server_ciphers on; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; # Just reverse proxy Futon, presuming that works... proxy_pass http://localhost:5984/_utils/; proxy_read_timeout 90; proxy_redirect http://localhost:5984/_utils/ https://my_futon_host/; } }
被褥似乎载入这个configuration,但我什么都不能做。 它只是抱怨它不能访问合适的CouchDB API端点。 这是有道理的,因为它们没有被反向代理,据推测蒲团试图直接打电话给他们。 有没有办法解决?
以下列方式编写位置块对我有用。 关键路线是为path添加重写指令。
location / { rewrite ^/(.*) /_utils/$1 break; proxy_pass http://localhost:5984; proxy_set_header Host $host; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_http_version 1.1; }