have you considered googling?
this is for redirection
server {
listen 80 default_server;
server_name xxx.com;
return 301 https://www.xxx.com$request_uri;
}
after editing the file you can do nginx -t to validate the config and then do nginx -s reload to reload config in nginx...