Adding a custom domain
With Surge, you can use your own domain in place of a surge.sh subdomain. This means you’ll be able to publish to your-own-domain.com.
Setting a CNAME
To get started, you’ll need have a custom domain and sign into your account to manage it. now:
- Add a new CNAME record to your domain.
- Set the hostnames
@
andwww
to:na-west1.surge.sh
Depending on your domain provider, it will look something like this:
If your DNS provider doesn’t support CNAME records for apex domains, you can set an A record to the following IP address instead:
45.55.110.124
- Additionally, setting the hostname
*
tona-west1.surge.sh
will allow you to deploy to custom subdomains on your domain as well.
Instructions from your DNS provider
More detailed instructions are available directly from your domain provider:
- Adding a CNAME using 1&1
- Adding a CNAME using Amazon Route53
- Adding a CNAME using Bluehost
- Adding a CNAME using CloudFlare
- Adding a CNAME using cPanel
- Adding a CNAME using Digital Ocean
- Adding a CNAME using dnsimple
- Adding a CNAME using domain discount 24
- Adding a CNAME using Domain.com
- Adding a CNAME using Google Domains
- Adding a CNAME using Dreamhost
- Adding a CNAME using Dynadot
- Adding a CNAME using Freeparking
- Adding a CNAME using Gandi.net
- Adding a CNAME using GoDaddy
- Adding a CNAME using HostMonster
- Adding a CNAME using Hover
- Adding a CNAME using iwantmyname
- Adding a CNAME using Linode
- Adding a CNAME using Name.com
- Adding a CNAME using Namecheap
- Adding a CNAME using Network Solutions
- Adding a CNAME using Nomeo
- Adding a CNAME using Pop.co
- Adding a CNAME using United Domains
- Adding a CNAME using WebFaction
Surge will be ready to use the domain right away, but it may take longer to propagate everywhere, depending on the internet service provider.
Deploying to your custom domain
Now you’re ready to deploy your project to your custom domain. With the Surge command line tool installed, you could run the follwing command:
surge path/to/my-project my-custom-domain.com
Saving a custom domain
You can save your custom domain so you don’t have to type it in each time you deploy. Simply add a CNAME
file (no extension) to the root of the project you’re deploying, and Surge will use that automatically.
You can create a new CNAME
using the following command:
echo your-own-domain.com > CNAME