Replace "domain.com" with your domain.
This example uses www as the end point, if you prefer non-www just change the two domain variations around in the first if statement.
if ($host = "domain.com") {
return 301 $scheme://www.domain.com$request_uri;
}
if ($scheme != "https") {
return 301 https://$host$request_uri;
}