Nginx redirect http to https

server {
    ...
    location / {
        redirect ^(.*)$ https://$server_name$1 permanent;
       ...
    }
    ...
}

Over!

7 thoughts on “Nginx redirect http to https”

Leave a Reply

Your email address will not be published. Required fields are marked *