Redirect NGINX HTTPS domain to new HTTPS domain

hello guys i want to 301 old domain on 1 server to new domain on my new server. Both domain have ssl enabled. So what are the steps that need to be followed for successful redirection. Tried everything but nothing seems to work. thanks

Are both servers using easyengine (and therefore nginx)?

Are you comfortable editing nginx .conf files?

How do you want the redirection to work, e.g. just old homepage to new homepage, all old URLs to new homepage or all old URLs to new domain URLs (i.e. old.com/oldpage > new.com/oldpage)?

Yes both servers are using easyengine. I can edit nginx conf files. I wish to get old.com/oldpage to new.com/oldpage

OK, then it should be sufficient to just add this to the main conf for the old domain:-

return 301 https://new.com$request_uri;

And reload nginx config.