nginx背后的kibana反向代理-“;上游过早关闭连接”;

nginx背后的kibana反向代理-“;上游过早关闭连接”;,nginx,kibana,Nginx,Kibana,我让kibana监听localhost:5601,如果我通过SSH隧道连接到这个端口,我可以在浏览器中访问kibana 我安装了nginx作为反向代理,但在完成安装后,我得到的只是502坏网关。nginx错误日志中更详细的错误是 *1 upstream prematurely closed connection while reading response header from upstream, client: 1.2.3.4, server: elk.mydomain.com, reque

我让kibana监听
localhost:5601
,如果我通过SSH隧道连接到这个端口,我可以在浏览器中访问kibana

我安装了nginx作为反向代理,但在完成安装后,我得到的只是
502坏网关
。nginx错误日志中更详细的错误是

*1 upstream prematurely closed connection while reading response header from upstream,
client: 1.2.3.4,
server: elk.mydomain.com,
request: "GET /app/kibana HTTP/1.1",
upstream: "http://localhost:5601/app/kibana"
我的nginx配置是:

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.fedora.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    index   index.html index.htm;
}
/etc/nginx/conf.d/
中我的
kibana.conf
文件是:

server {

    listen 80 default_server;
    server_name elk.mydomain.com;

    auth_basic "Restricted Access";
    auth_basic_user_file /etc/nginx/htpasswd.users;

    location / {
        proxy_pass http://localhost:5601;
        proxy_http_version 1.1;
        proxy_set_header Upgrade \$http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host \$host;
        proxy_cache_bypass \$http_upgrade;
    }
}
这是一个全新的Amazon Linux EC2实例,安装了最新版本的kibana和nginx


以前有人遇到过这个问题吗?我觉得这是一个简单的nginx配置问题,但我就是看不出来。

结果是,在美元
代理集\头升级\$http\u升级之前的斜杠是从另一个配置管理工具复制粘贴的结果

我删除了不必要的斜杠,使
proxy\u set\u头升级$http\u升级并恢复了我的理智