使用nginx 代理内网中的es的head插件访问

一 背景需求描述

1.1 需求描述

es的访问地址:http://localhost:9200/_plugin/head/

使用nginx 代理内网中的es的head插件访问_第1张图片

 现在不想把9200端口暴露出去,改用80端口,现在使用nginx进行反向代理操作。

1.2 操作一

1.nginx的配置

       location /es {
            proxy_pass http://localhost:9200/;
            #root   html;
            #index  index.html index.htm;
        }

2.访问:http://localhost/es/_plugin/head/

使用nginx 代理内网中的es的head插件访问_第2张图片

 无法进行访问,原因在于:被nginx代理成的地址为:http://localhost:9200//_plugin/head

  而不是正确的地址:http://localhost:9200/_plugin/head

3.nginx重新配置

       location /es/ {
            proxy_pass http://localhost:9200/;
            #root   html;
            #index  index.html index.htm;
        }

使用nginx 代理内网中的es的head插件访问_第3张图片

 

你可能感兴趣的:(nginx,elasticsearch,大数据,搜索引擎)