The hostname of the URL must match the Common Name ("CN") of the Subject of the certificate. When you generate the Certificate Signing Request (CSR), OpenSSL prompts you for the country code, state or province, locality, organization, organizational unit, Common Name, and email address. Be sure to enter the hostname of your server as the Common Name. The CN can also be a wildcard (*.example.net).
It is also possible to generate a certificate that is valid for multiple discrete hostnames (not a wildcard), in which case the hostname can also match one of the subjectAltNames of the certificate. There are are two ways to create such a certificate with OpenSSL.
The easy way is for the Certificate Authority to put it into the signed certificate. The CA's openssl.cnf needs
[ usr_cert ]
subjectAltName=DNS:host1.example.com,DNS:host2.example.org
The other way is to put the subjectAltName in the CSR and have the CA honor it. In the requestor's openssl.cnf:
[ v3_req ]
subjectAltName=DNS:host1.example.com,DNS:host2.example.org
In the CA's openssl.cnf:
[ usr_cert ]
subjectAltName=email:copy
Either way, the generated certificate should be valid for three hostnames (host1.example.com, host2.example.org, and the CN of the subject).