Skip to content

Point a Domain Name

Video Lecture

Point a Domain Name Point a Domain Name

Description

I have a domain already, and I can add subdomains to it, so I will create a new subdomain for my-project.sbcode.net.

In my domain name provider, I will create a new A name record called my-project for my main domain sbcode.net that will point to the IP address of the new server.

Note that you will be using a domain name that you manage yourself and not sbcode.net.

Give it some time to propagate, and then visit

http://my-project.your-domain.tld

or perhaps you just pointed your main domain to your IP address, and you can then access your website without the subdomain, e.g.,

http://your-domain.tld

If you intend to host multiple projects on your server using domain names on the same port, e.g., port 80 as shown in this example, then be sure to set the server_name property in your Nginx configuration for your website.

E.g. My updated Nginx my-project.conf,

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
server {
        listen 80;
        listen [::]:80;
        server_name my-project.sbcode.net;

        root /var/www/my-project;
        index index.html;

        location / {
                try_files $uri $uri/ =404;
        }
}

Check syntax is ok, restart and check status

nginx -t
sudo service nginx restart
sudo service nginx status

Purchasing A Domain

If you don't have a domain name, and your colleagues can't lend you one or create a subdomain for you, then you can get cheap domains from Namecheap

Namecheap also has an advanced DNS config tool which allows you to create subdomains. The @ symbol in the image below is an alias for the main domain that is being managed.

Namecheap Advanced DNS

The my-project line above, is an example of a subdomain A name record as set up in Namecheap advanced DNS tool for the domain being configured.

The ###.###.###.### texts in the image above, will be the IP addresses of the servers that your main or sub domain names should point to.

Comments