Nginx 를 reverse proxy 로 설정해서 ES 와 연동할 수 있습니다.


이럴 경우 ES를 사용하는 client는 ES 의 포트인 9200 이 아니라 nginx 가 사용하는 포트로 연결할 수 있습니다.


이렇게 설정할 경우 외부에서 ES 에 직접 연결해서 index 삭제등의 위험한 작업을 할 수가 있으니 접근 권한을 꼭 설정해야 합니다.

events {
    worker_connections  1024;
}

http {

  upstream elasticsearch {
    server 127.0.0.1:9200;

    keepalive 15;
  }

  server {
    listen 80;
	
	server_name elastic.local;
	charset utf-8;
	
	access_log /var/log/nginx/elastic.local-access.log combined;
    error_log  /var/log/nginx/elastic.local-error.log error;
    location / {
      proxy_pass http://elasticsearch;
      proxy_http_version 1.1;
      proxy_set_header Connection "Keep-Alive";
      proxy_set_header Proxy-Connection "Keep-Alive";
    }

  }

}
CODE

Ref