Domain name configuration

Once you have a server working on an IP address and have created an administrative user and some basic content you should associate a domain name with your server. This means that instead of contacting an IP address, your users will type in a recognisable and memorable address (such as yoursite.com) in the browser address bar. 

The first step in doing this is to purchase a domain name with a domain registrar. I have used namecheap.com for several years and had few issues, so I will use their user interface for Illustrating how to connect a domain name to a Saltcorn server. However, other domain registrars should have similar interfaces.

In these examples, we will connect a purchased domain saltcorn.net to a server running on the IP address 142.93.37.247

Once you have purchased your domain, you have to set up a domain name system record to point at your server. On Namecheap, in the management for the domain, go to the advanced DNS tab. This is where we will set the different records according to to how we want to to configure this domain name.

Single domain

In the simplest case, you just want to connect your domain to the server. This is done with an A record,  which simply associates an address with an IP address. The A record is set for specific subdomains, in this case we use the @ symbol which denotes the root domain, here saltcorn.net

Sometimes you also want to catch people putting a www in front of the domain name, in our case if they are are accessing www.saltcorn.net. You can do this in two different ways, either by setting up a CNAME record to redirect to the root domain, or by directing all subdomains to the same IP address using an A record. In the latter case we again use a special symbol for the subdomain, here the the * means all subdomains that do not have their own DNS records.

With CNAME: 

or with a A * record: 

Inside Saltcorn, in site settings, the base url should be your domain name preceded by http:// or https://, in our case

You can now enable LetsEncrypt SSL certificates

Single subdomain

Perhaps you are using your root domain for a different application and this is directed to a different server, but you want to direct a specific subdomain to a saltcorn server. In that case you need to to create an a record for that subdomain and pointed to your saltcorn servers IP address. For instance, to direct app.saltcorn.net to an IP address:

In the Saltcorn site settings, the base url should be your full subdomain address, in our case

You can enable LetsEncrypt SSL certificates at this point


Multi-tenant DNS settings

In a multi tenant setup, you want different subdomains to go to different tenants on the same Saltcorn server. The DNS setup is the same as for a single subdomain where you use an A *  record to direct all subdomains to the same IP address.

Tips and Tricks

Changes to your DNS setup can take a long time to propagate throughout the internet. some cloud providers (including Digitalocean) offer a floating IP facility Where you can associate your domain name to an IP address that you can quickly reassign to different servers. 

If you do not use a floating IP facility consider keeping your TTL values low in the DNS settings (e.g. 5 mins) which will cause changes to propagate more quickly come out but will also mean that your users will experience slightly longer response times because they more frequently have to look up the DNS record. You could keep your TTL values low until your setup has stabilized and then you can increase them

Cloudflare offers a great free service that you can use by making them your name server.