If you are trying to issue an SSL, please read some CA Documentation, they'll provide some code references to do so.
In other hand, if you generate a SSL and have problems when open in http vs https, then you must check your configuration for VirtualHosts and patch it to open correctly with port 443 (Secure).
VirtualHosts, apache conf, other stuffs:
This tutorial shows you how to set up a new directory, how to grant the correct permissions, how to add content to a new page, how to turn on virtual hosting, and how to, if needed, set up local hosts. Virtual Hosts are used to run more than one domain off of a single IP address and allows you to run multiple sites off of a single DigitalOcean droplet. This tutorial describes how to set up virtual hosts with Apache.