【发布时间】:2015-05-26 16:57:06
【问题描述】:
我有以下设置:
/etc/nginx/sites-available/elasticsearch
server {
listen 80;
server_name xxx.xxx.xxx.xxx;
auth_basic "Elasticsearch Authentication";
auth_basic_user_file /etc/elasticsearch/es.pwd;
location / {
rewrite ^/(.*) /$1 break;
proxy_ignore_client_abort on;
proxy_pass http://localhost:9200;
proxy_redirect http://localhost:9200 http://xxx.xxx.xxx.xxx/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
}
无论何时
curl -i -u 用户:通过http://xxx.xxx.xxx.xxx/
我得到 401 需要授权
如果我从 nginx conf 中删除 auth_basic,一切都会顺利进行。 我很清楚 auth 位是有问题的。我做错了吗?
【问题讨论】:
-
是的,我刚开始的时候就是这样。我遵循了本指南:minvolai.com/blog/2014/08/…
标签: nginx elasticsearch