A common task is to rewrite HTTP requests to HTTPS to secure communication. Using nginx, this is easily done with:
# use only https
if ($scheme = http) {
rewrite ^ https://$host$uri permanent;
}
This should be placed in a server block.
Leave a Reply