Rails Deployment - SSH to Domain instead of IP
I’m running my Rails application on an Ubuntu 18.04 server. I purchased a domain for my server and I’m able to reach my website on this domain without problems - so my droplet configuration worked perfectly.
Now I want to change my Capistrano-Config to use the domain instead of the IP-address for deployment, but I can’t SSH on the VPS by using the domain name.
So if I try: ssh deploy@ip-address it works, but if I do ssh firstname.lastname@example.org I get the connection error: ssh: connect to host example.de port 22: Connection timed out
Shouldn’t the DNS-Server map my domain name to the IP-address? I read in some threads that I should edit the /etc/hosts file, but some others say it’s not good practice.
What am I missing? I’m relatively new to this topic, so maybe someone can give me a good hint?
Thanks in advance!