sinewaves, finally I managed to solve.
I will leave here the solution found to this issue. If you have someone else with this problem may be useful.
In your SFTP manager navigate to: /etc/nginx/conf.d
Within this directory, create a .conf file can be for example: redirect.conf
server_name www.sub.example.com;
return 301 $scheme://sub.example.com$request_uri;
And then within the redirect.conf place the code, save and restart nginx.
If all went well, you are done magic.
Thanks for your help sinewaves.