nginx

Name of Innovation

nginx

November 23, 2017 Uncategorized 0

sudo apt-get install nginx

sudo service nginx stop

sudo nginx -c $PWD/nginx_keep_alive.conf

######### To run Nginx as a “100% transparent” proxy for Elasticsearch ###############

events {
    worker_connections  1024;
}
http {
  server {
    listen 8080;
    location / {
      proxy_pass http://localhost:9200;
    }
  }
}



######################## Persistent Connection ##########################

events {
    worker_connections  1024;
}

http {

  upstream elasticsearch {
    server localhost:9200;

    keepalive 15;
  }

  server {
    listen 8080;

    location / {
      proxy_pass http://elasticsearch;
      proxy_http_version 1.1;
      proxy_set_header Connection "Keep-Alive";
      proxy_set_header Proxy-Connection "Keep-Alive";
    }

  }

}

################### Load Balancer - Round Robin Fashion ##########################




events {
    worker_connections  1024;
}

http {

  upstream elasticsearch {
    server 127.0.0.1:9200;
    server 127.0.0.1:9201;
    server 127.0.0.1:9202;

    keepalive 15;
  }

  server {
    listen 8080;

    location / {
      proxy_pass http://elasticsearch;
      proxy_http_version 1.1;
      proxy_set_header Connection "Keep-Alive";
      proxy_set_header Proxy-Connection "Keep-Alive";
    }

  }

}