Redirect http to https on Nginx

Nginx configuration:

server {
        listen 80;
        listen 443 ssl;
        server_name ...;
        ssl_certificate /path/to/certif;
        ssl_certificate_key /path/to/privatekey;

        #redirection
        if ($scheme != "https") {
                return 301 https://$host$request_uri;
        }

        # whatever you do to return response 
        root /home/admin/web;
}