Nginx SSL redirect
From KOP KB
A basic ssl redirect, now if your are not doing default ports for ssl. You will need to put the port in between host and request_uri so it goes to the right place.
server{
listen 80;
server_name domain.com www.domain.com;
rewrite ^ https://$host$request_uri permanent;
}