Elasticsearch : Connection refused while connecting to upstream Elasticsearch : Connection refused while connecting to upstream elasticsearch elasticsearch

Elasticsearch : Connection refused while connecting to upstream


Seems like upstream and a different keepalive is necessary for the ES backend to work properly, I finally had it working using the following configuration :

upstream elasticsearch {    server 127.0.0.1:9200;    keepalive 64;}server {  listen 8080;  server_name myserver.com;  error_log   /var/log/nginx/elasticsearch.proxy.error.log;  access_log  off;  location / {    # Deny Nodes Shutdown API    if ($request_filename ~ "_shutdown") {      return 403;      break;    }    # Pass requests to ElasticSearch    proxy_pass http://elasticsearch;    proxy_redirect off;    proxy_http_version 1.1;    proxy_set_header Connection "";    proxy_set_header  X-Real-IP  $remote_addr;    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;    proxy_set_header  Host $http_host;    # For CORS Ajax    proxy_pass_header Access-Control-Allow-Origin;    proxy_pass_header Access-Control-Allow-Methods;    proxy_hide_header Access-Control-Allow-Headers;    add_header Access-Control-Allow-Headers 'X-Requested-With, Content-Type';    add_header Access-Control-Allow-Credentials true;  }}