The following snippet does this in a general way, without having to hardcode any host names (useful if your server configuration handles requests for multiple domains). Add this to any server definition you need.
if ($http_host ~ "\.$" ){
rewrite ^(.*) $scheme://$host$1 permanent;
}
, $host , $http_host doesn (ta > tn > "; $http_host $host .