HOSTING / LESSON 08
Railway Custom Domains.
Connecting your own domain

Loading the lesson…
Loading activities…
HOSTING / LESSON 08
Connecting your own domain

Loading the lesson…
Loading activities…
Your app works great at my-app.up.railway.app, but let's be real, nobody's remembering that. Wouldn't your own domain like myawesomeapp.com be nicer? In this lesson you'll connect a custom domain to your Railway app.
A domain name is a human-friendly address for a website. You remember a name, and you get to skip memorizing a string of numbers (like an IP address).
google.com is a domain namerailway.app is a domain nameyour-name.com could be your domain nameWhen you type a domain into your browser, the internet's phone book (called DNS) looks up the real address and sends you there.
Before you can use a custom domain, you have to own one. Here's how.
A registrar is a company that sells domain names. A few popular ones are below.
Go to any registrar and search for the name you want. It'll tell you if it's available.
If it's open, add it to your cart and check out. Common endings like .com are pretty cheap per year, and the registrar shows you the exact price (including the renewal price, which can be higher) before you pay.
The registrar may ask you to verify your email address. You have to do this one.
DNS (Domain Name System) is basically the internet's phone book. It connects domain names to actual server addresses.
When you type myapp.com in your browser, this happens.
To use a custom domain with Railway, you add DNS records that point your domain at Railway.
You'll mostly work with two kinds.
A Record. Points a domain to an IP address
CNAME Record. Points a domain to another domain
Railway uses CNAME records because their IP addresses can change. Your domain points at Railway's domain, and Railway handles the rest.
Now let's hook your domain up to your Railway app.
Go to your Railway project and click your app service.
Click the "Settings" tab.
Scroll down until you find "Domains" or "Custom Domains."
Click "Add Domain" and type in your domain name.
Railway will show you a target port to pick (just choose the one your app listens on) and then TWO DNS records you need to add. They'll look something like this.
The CNAME points your domain at Railway. The TXT record proves you own the domain. You need BOTH, because without the TXT record your domain shows a 404 even when the CNAME is right. Copy that info down.
Next you tell your domain registrar where to point your domain.
Go to the website where you bought your domain and sign in.
Look for "DNS Settings," "Manage DNS," or "Name Servers." Where it lives depends on the registrar.
Create a new CNAME record using the values Railway gave you.
@ for the main domain or www for the www versiong05ns7.up.railway.app)Then create the TXT record exactly the way Railway shows it.
Click Save. DNS changes take a while to spread across the internet.
Most websites work with both myapp.com and www.myapp.com. Railway counts those as two separate custom domains, and the free trial only allows one (the Hobby plan allows two per service, as of October 2026). So you'll need a paid plan to do both. Here's how.
In Railway's domain settings, add both versions.
myapp.comwww.myapp.comAt your registrar, create a record for each one.
For myapp.com (root domain), it looks like this.
For www.myapp.com, it looks like this.
When you visit a site with https://, your connection is encrypted. That takes an SSL certificate. Good news, Railway handles it for you automatically!
Once your domain is connected, here's what happens.
You don't buy a certificate or configure a thing. It just works.
You can point a bunch of domains at the same Railway app. That comes in handy for things like these.
Just add each domain in Railway's settings and set up DNS for each one. Keep in mind your plan limits how many custom domains each service can have.
Your app is deployed on a real domain now. But how do you know it's actually working right? Next lesson, you'll learn to monitor your app and read logs so you can catch problems and fix them.