Redirect http to https on Nginx vhosts


Update your virtual host configuration like this:

...
server {
  listen *:80 default_server;
  listen *:443 ssl;
  ssl_certificate  /path/to/your/certificate/ssl.crt;
  ssl_certificate_key  /path/to/your/certificate/ssl.key;
  if ($server_port = 80) {
        rewrite ^ https://$host$request_uri permanent;
  }
.....