一 背景需求描述
1.1 需求描述
es的访问地址:http://localhost:9200/_plugin/head/
现在不想把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代理成的地址为: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;
}