In last tutorial we introduce our technology stack. Before we begin developing our website we must do some shopping and setting:
- Subscribe to a server hosting service.
- Find your IP.
- Purchase a domain.
- Connect domain to your server in the DNS record.
- (Optional) Configure DNS for subdomains.
We will focus on #4, connect domain to the server. This is the part that is confusing and is normally absent in other tutorials.
Subscribe a Web Hosting Service
Google “web hosting” and tons of service providers popup. For beginners a bundle plan offered by sites like Godaddy is more suitable, as it frees you from configuring individual parts of your server.
Find Your IP
Once you subscribe to a hosting service you will be given an IP address to connect to server (look for “manage”,”configure” tabs on the website’s admin panel ).
IP address is like your house’s building address. The Internet uses an IP address to transmit messages to the correct server. It normally looks like a set of 4 numbers separated by dots:
This is the older type of IP called IPv4. There is a new one called IPv6 which has a longer number, but many hosting companies have yet to fully adopt this new IP type.
Purchase a Domain
A domain is an easy-to-remember string that represents your server. We normally use domain to access a website like “www.google.com” rather than using an IP. As a result a domain name is really important for your website.
Google “domain name” and many services called “domain registry” will show up. There is no difference choosing one to another. Price should be around $10/year.
Connect domain to the server
If you subscribe your server and purchase a domain from the same company (like Godaddy.com) they will automatically link domain name to your server’s IP. However if you buy them separately you have to link them yourself.
To do so you have to configure your domain’s DNS, or domain name system. What DNS do is to make sure everywhere on the Internet users cam find your server by associating your domain name to your server IP.
To do so, go to your domain management web panel and find something like “Manage DNS”. It will show something like a table called “Record”:
What you want is to create an “A” record (First row above). It is one type of record that associates domain name (as “Name above) to your server IP (as “Value”).
To setup a record, click “Add”, select “type” as “A”, “Name” as “@”, “Value” as [your IP], and for “TTL” use the default value. “@” means your root domain like “example.com”.
The last column “TTL”, or “Time to Live” tells all DNS servers on the Internet how long untill they have to update their records again. Default value should be ok, but a smaller value makes sure the new changes made in the record can spread to the entire Internet faster.
Once you add the “A” record it takes some time to take effect, sometimes up to 2 days.
(Optional) Configure DNS for subdomains
When you register for a domain like “
example.com” it is a root domain. Once you purchase the root domain you can freely use many other subdomains like “blog.example.com” or “shop.example.com“.
Subdomains are useful for directly connecting users to different features of your web applications, like your blog or online store.
Many times these features’ applications are on the same computer. In this case you have to tell DNS to associate subdomains to the computer’s IP.
To do so you can use a wild card in an “A” record. A wild card is a set of symbols that can represent multiple words. To create an “A” record that associates all subdomains to the server IP , use the following steps:
- Click “Add”
- Select “type” as “A”
- “Name” as “*.@“
- “Value” as [your IP]
- Use default “TTL”
The wild card “*.@” means to match any words (“*”), followed by a dot (“.”), then the root domain (“@”).