/
Elastic Search 와 nginx 연동

Elastic Search 와 nginx 연동

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";
    }

  }

}

Ref

Related content

nginx HTTP 로 들어오면 강제로 HTTPS 로 전환하도록 설정하기(force redirect to SSL)
nginx HTTP 로 들어오면 강제로 HTTPS 로 전환하도록 설정하기(force redirect to SSL)
More like this
nginx 로드 밸런싱 설정 (load balancing)
nginx 로드 밸런싱 설정 (load balancing)
More like this
nginx 대표 도메인으로 포워딩 하기(www to no-www)
nginx 대표 도메인으로 포워딩 하기(www to no-www)
More like this
nginx 에 HTTPS/SSL 적용하기
nginx 에 HTTPS/SSL 적용하기
More like this
OpenResty 설정하기
OpenResty 설정하기
More like this
중요 파일 접근 차단
중요 파일 접근 차단
More like this