Can I view my ssl FQDN? How do I fix the mismatch

I have probably set wrong FQDN while creating ssl certificate.

Now, certificate is installed and site display a ‘Warning: Potential Security Risk Ahead’

I am quite sure it is FQDN as certificate was bought from a company where i have installed ssl successfully in the past.

I get this detail on the site:

-when visiting https: www.mydomain.com: Web sites prove their identity via certificates. Firefox does not trust this site because it uses a certificate that is not valid for www.mydomain.com. The certificate is only valid for mydomain.com.

-when visiting https mydomain.com:

mydomain.com uses an invalid security certificate. The certificate is not trusted because it is self-signed.

How can I view ssl FQDN and how to fix the issue.

How to change the FQDN on a Lightsail instance?

I’ve spent the last number of hours trying to work out what’s causing the error “hostname: Name or service not known” to be produced when I run the command “hostname -f” on the latest version of Debian 9. When I run “hostname” I get the hostname ok though and I suspect that it is something to do with the fact that lightsail automatically alters the FQDN hosts.debian.tmpl file (I think). How to I change the FQDN on a Lightsail instance successfully?

trying to use FQDN but now my hostname is invalid

I’m trying to use FQDN, but since i don’t really know how to do it now every time i use command hostname -f it will always return “the specified hostname is invalid”
would you guys kindly tell me where did i go wrong ?
i use sudo hostnamectl set-hostname hostname to change my hostname
and changed my “etc/hosts” to

127.0.0.1 localhost
127.0.1.1 hostname.mydomain.com hostname
[MyVpsIP] hostname.mydomain.com hostname

my hostname used to be “ubuntu”
(btw i use cloudflare to point my domain to my vps)
please help me guys i’m new to this kind of stuff
(and no, my hostname not using underscore(_) in it )