使用路径隐藏端口 - nginx

hiding port with a path - nginx

我在本地主机的端口 9292 上安装了 kibana 运行。我想要实现的是当我输入 http://ip_adress/kibana the page from port 9292 will be loaded but path will remain http://ip_address/kibana/index.html#/dashboard/file/default.json what I get instead is http://ip_adress:9292/index.html#/dashboard/file/default.json

这是我的代码:

server {
    ...
    location /kibana {
         return 301 /kibana/;
    }
    location ~ /kibana/(.*) {   
            error_log /var/log/nginx/kibana-error.log debug;
            proxy_pass   http://ip_address:9292/;
    }   
}

最后我将 Kibana 从 3 更新到 4,这很有帮助,现在我正在使用这个配置:

upstream kibana {
    server 127.0.0.1:5601;
}
...
location /kibana {
    return 301 /kibana/;
   }
   location ~ /kibana/(.*) {    
    proxy_pass   http://kibana/;
 }