Nginx implements jump configuration between two domain names

1. I have two domain names, www.a.com and www.b.com . Now I want all www.a.com access addresses to jump to www.b.com , such as https://www.a.com/sample.html to https://www.b.com/sample.html.
2. The following is the nginx configuration of my domain name www.a.com :

server{
    listen 80;
    server_name www.a.com a.com;
    return 301 https://$server_name$request_uri;
}


server {
   listen 443 ssl http2;
   server_name a.com www.a.com;
   index  index.php index.html index.htm;
   root   /usr/share/nginx/iwwenbo;
   add_header X-Frame-Options DENY;
   add_header X-Content-Type-Options nosniff;

   ssl_certificate /etc/letsencrypt/live/a.com/fullchain.pem;
   ssl_certificate_key /etc/letsencrypt/live/a.com/privkey.pem;
   ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
   ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
   ssl_prefer_server_ciphers on;
   ssl_session_cache shared:SSL:10m;
   ssl_session_timeout 60m;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;
        include        fastcgi_params;
    }

}

I would like to ask how to modify to achieve the above functions, all the addresses of https://www.a.com/sample.html will be transferred to https://www.b.com/sample.html.

= update=
problem has been solved successfully. For more information on the solution, please see nginx configuration Jump between two domain names url (https configuration) ;

Mar.20,2021


301:

Nginxsever:

 server
         {
     listen 80;
     listen 443 ssl;
     server_name www.a.com;-sharp
     ssl_certificate *********;
     ssl_certificate_key *************;                            
     if ( $scheme = "http" ) {
         return 301 https://www.b.com$request_uri;-sharpHTTPSHTTPS
     }
     location / {
         rewrite ^(.*)$  https://www.b.com$1 permanent; -sharp
     }
     }  

my old domain name is blog.ymanz.com, and the new domain name is www.imydl.com. This is how it is configured to jump! Does not affect SEO!

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e49300-43a4c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e49300-43a4c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?