I am trying to configure HTTPS for elasticsearch using nginx as reverse proxy. I need to access localhost:9200 through HTTP request only. So even if the user tries to access http://localhost:9200 ,it should redirect to https://localhost:9200.
here is my nginx.config file,
server {
listen 80;
server_name localhost;
return 301 https://localhost:9200;
}
server {
listen 443 ssl;
server_name localhost;
ssl_certificate C:/xxxx/cert.pem;
ssl_certificate_key C:/xxxx/newkey.pem;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://localhost:9200;
}
}