how to create a private repository in my own server and expose that registry

I created a local docker repository in my server.
When I try to push the image into it, there is an error.
I need an HTTPS connection.
How do I get an HTTPS for my own docker registry?

Docker version 18.06.1-ce, build e68fc7a
os: ubuntu 16.x

Expected: I should be able to push and pull images into my own server containing docker registry

Source: StackOverflow