How To Set Up A Domain For Your Application and Server!

No Comments
Modified: 14.08.2023

Are you looking to set up a domain for your hosted application and server? Look no further! In this comprehensive guide, we’ll go through the entire process step-by-step. From purchasing a domain to setting up DNS records so that you can bring your side project online!

Don’t want to read? Watch the video instead!

Introduction

In this four-part series, we already learned how to set up a server (VPS), and we successfully hosted a simple application using Docker, making it accessible through a web browser using the server’s IP address. However, to give our project a unique identity and make it easier to find, we need to set up a domain for our application. By the end of this post, you’ll be able to access your application under your domain with HTTP, and in the next post, we will secure it with HTTPS, giving your project a more professional and secure look.

Get a domain and set it up for your server

Before we can set up the domain for your server and, ultimately, for your application, we need to purchase a domain. In this post, I will show you how it works when using Hostinger, but it works similarly with other domain providers.

In case you do not have a domain yet, you can support me by buying a domain through one of the affiliate links below:

For Hostinger, the steps are as follows:

  1. Go to Hostinger domain search.
    go to hostinger domain search
  2. Enter the domain you want and click on search.
    search domain for application
  3. Add the domain to the cart.
    add domain to cart
  4. Choose the plan you want.
    choose domain plan
  5. After paying, finish the domain registration.
    finish domain registration
  6. Click continue (and check your email to verify the domain).
    set up domain for application: go to domain

After purchasing the domain, you must create an A record pointing to your server. This basically tells the DNS where the requested resource is (your server).

Need help or want to share feedback? Join my discord community!

For Hostinger, the steps are as follows:

  1. Go to DNS / Nameservers.
    go to dns / nameservers
  2. Select A record type.
    set up domain for application: choose a record as type
  3. Enter subdomain or @ for the main domain.
    set up domain for application: specify subdomain or use @ for main domain
  4. Enter the IP of your server.
    set up domain for application: enter ip of your server
  5. Change TTL to 3600 or leave it as is.
    change ttl to 3600 or leave it as is
  6. Finally, add the Record.
    set up domain for application: add the record

Conclusion

In this series of posts, we already learned how to set up a server (VPS), how to host our first application using docker, and how to set up a domain. In the next post, we will learn how to secure it using reverse proxy and SSL certificates. There are three different options available for the next step. Just continue with the one that sounds the best to you, try all of them out, and find your favorite (mine is option 2), or you can read my comparison of them:

KOFI Logo

If this guide is helpful to you and you like what I do, please support me with a coffee!

  1. traefik: a bit more complex but more powerful and automated
  2. caddy: simple, powerful, but manual
  3. nginx-proxy and letsencrypt-companion: simple and automated

I hope these posts were helpful to you. If so, share them with your friends, and let me know if you have questions!

In case you liked this consider subscribing to my newsletter and joining my discord community!

[convertkit form=2303042]

Discussion (0)