Try this:
upstream elasticsearch {
server 10.X.X.X:9400;
keepalive 10;
}
server {
listen 9200;
return 301 https://$host:9400$request_uri;
}
server {
listen 9400 ssl;
ssl_certificate /etc/pki/tls/certs/validcert.crt;
ssl_certificate_key /etc/pki/tls/private/validcert.key;
location / {
auth_basic "Protected Elasticsearch";
auth_basic_user_file /etc/nginx/htpasswd.users;
proxy_pass http://elasticsearch;
proxy_redirect off;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
}
}
The SSL certificate and key paths are specified. location / block handles the proxying to the upstream Elasticsearch server, as before.
I Hope this help you.
upstream elasticsearch {
server 10.X.X.X:9400;
keepalive 10;
}
server {
listen 9200;
return 301 https://$host:9400$request_uri;
}
server {
listen 9400 ssl;
ssl_certificate /etc/pki/tls/certs/validcert.crt;
ssl_certificate_key /etc/pki/tls/private/validcert.key;
location / {
auth_basic "Protected Elasticsearch";
auth_basic_user_file /etc/nginx/htpasswd.users;
proxy_pass http://elasticsearch;
proxy_redirect off;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
}
}
The SSL certificate and key paths are specified. location / block handles the proxying to the upstream Elasticsearch server, as before.
I Hope this help you.