NGINX:尝试访问 AWS Elasticsearch 域时出现 502 错误网关错误

时间:2021-05-09 14:25:44

标签: elasticsearch nginx nginx-reverse-proxy

我正在尝试使用反向代理来访问 AWS Elasticsearch。下面是我的default.conf

server {
    listen 80; 
    listen 443 http2; 
    server_name ${DOLLAR}host;
    rewrite ^/$ https://${DOLLAR}host/_plugin/kibana redirect;

    location /_plugin/kibana {
        # Forward requests to Kibana
        proxy_pass https://${ESHost}/_plugin/kibana;

        # Update cookie domain and path
        proxy_cookie_domain ${ESHost} ${DOLLAR}host;
        proxy_cookie_path / /_plugin/kibana/;
        proxy_set_header X-Real-IP ${DOLLAR}remote_addr;
        proxy_set_header Host ${DOLLAR}host;
        proxy_set_header X-Forwarded-For ${DOLLAR}proxy_add_x_forwarded_for;

        # Response buffer settings
        proxy_buffer_size 128k;
        proxy_buffers 4 256k;
        proxy_busy_buffers_size 256k;
    }

    location ~ \/(log|sign|fav|forgot|change|saml|oauth2) {

        # Handle redirects to Kibana
        proxy_redirect https://${ESHost} https://${DOLLAR}host;

    }
}

docker-entrypoint.sh

export DOLLAR='$'
envsubst < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
nginx -g "daemon off;"

但是当我尝试访问 url 时,我不断收到 502 Bad Gateway。无法理解如何解决这个问题???

当我跑步时

nginx -t

我收到了这个回复:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

0 个答案:

没有答案