Article overview

Help article

DirectAdmin Tutorial Series 4: adding domains and subdomains

This is the fourth part of our DirectAdmin Tutorial Series. If you are planning a new VPS, then we recommend starting with part 1 and to not skip any parts.

Linking your domain to your VPS

Before you can use your domain within DirectAdmin, your domain has to be linked to your VPS. To do this, you refer your domain to your VPS in your DNS settings and configure your domain in DirectAdmin.

Your VPS automatically comes supplied with an IPv6 address, but before you can use it in DirectAdmin, you link your IPv6 address to your IPv4 address in DirectAdmin.

Linking extra (sub)domains to your VPS

With DirectAdmin, you easily use a subdomain or extra domain on your VPS. Once linked, you repeat the exact same steps in the next two chapter of this manual for hosting a site, database or email on the extra (sub)domain.


DNS

 

Websites that you host on your VPS for your domain are not automatically accessible to the whole world. You have to refer DNS records from your domain to your VPS for this. Below is an example of what the DNS records of your domain could look like.

dns of a domain linked to a vps

It takes up to 24 hours (often shorter) before DNS changes are processed and visible worldwide. This is something that we have no influence on, unfortunately.

Please note: The ins and outs of DNS fall outside the scope of this manual. See our article on setting DNS records for more information about setting up DNS.


DirectAdmin

 

In addition to setting up your DNS, you add your domain in DirectAdmin. This is necessary to use functions such as the file manager.

At the beginning of this tutorial series, we explained how to create an SSH user. Once you have done that, a domain is also requested for this user. If you have added the domain for which you want to host a site at this point in the creation of this SSH user, log in to DirectAdmin as that SSH user and you can then continue directly to the section on IPv6 below.

Step 1

Log in to DirectAdmin as the user to which you want to link your domain and switch to 'User Level' under the 'Access Level' option. At 'User Level' you manage your domains, mail, and database.

DirectAdmin top menu


 

Step 2

In the case of a new VPS, a page with the message 'No data to show' will now appear. This happens because there is no domain in DirectAdmin yet. Click 'Domain administration'.

DirectAdmin domain administration


 

Step 3

In the overview that appears 'No data to show' will be displayed again because no domain is linked in DirectAdmin. Click 'Add another domain' at the top left.

directadmin add another domain


 

Step 4

Then enter your domain name and click 'create'. DirectAdmin automatically creates (next to the other required settings) an email address for this user with the syntax 'username@yourdomain.com'.

directadmin create domain


IPv6

 

If you want to use IPv6, then an additional adjustment is required within DirectAdmin. Without this adjustment, visitors to your domain using IPv6 will see an 'Apache is functioning normally' message.

DirectAdmin uses a system in which you link IP addresses when you want to link more than 1 IPv4 address to your domain or if you use IPv6. You link your IPv6 address as follows:

 

Step 1

Log in to DirectAdmin at 'Admin Level' and click 'IP Management'.

DirectAdmin IP management


 

Step 2

Click the IPv4 address that you linked to your domain. You can see which IPv4 address you have linked in your DNS settings, see for example the previous screenshot under 'DNS'. For the VPS which we used for this manual, this is 185.10.50.51.

DirectAdmin IP overview


 

Step 3

Under 'Select an IP to Link to <your IP address>', select your IPv6 address and click 'Link'.

DirectAdmin link ipv6

Please note: Usually IPv6 addresses are abbreviated (truncated) to, for example, 2a01:7c8:aaaf:333::1. DirectAdmin completely writes your IPv6. This is how 2a01:7c8:aaaf:333::1 looks as 2a01:7c8:aaaf:0333:0000:0000:0000:0001 in DirectAdmin.

Your IPv6 address is now linked to your IPv4 address and your domain is now accessible via both IPv4 and IPv6.


Adding a subdomain

 

Adding a subdomain consists of two parts: you refer to your subdomain in your DNS records for the domain. In DirectAdmin, you then also add the subdomain.

These steps only ensure that you can host a website on your subdomain. If you also want to be able to use email on your subdomain (e.g. example@subdomain.yourdomain.com), proceed to the 'Add a domain' section under these steps.


 

Step 1

Create a subdomain in your DNS records, such as the subdomain 'subdomain' in the screenshot below and click 'Save'.

dns of a domain linked to a vps with a subdomain

By using a CNAME record with the value @ you tell the DNS system that your subdomain uses the same IPv4 and IPv6 address as the A and AAAA record set for the root of your domain itself.


 

Step 2

Within DirectAdmin itself you also create the subdomain so, for example, a folder is created on the FTP server. Log in to DirectAdmin at 'User Level' and click 'Subdomain Management' under 'Your Account'.

DirectAdmin subdomain management


 

Step 3

Enter the name of your subdomain after 'Add Sub-Domain' and click 'Create' at the bottom right.


Adding an extra (sub)domain

 

If you want to add an additional domain in DirectAdmin or add a subdomain in which you can also use email, use Domain Setup:

Step 1

Log in at 'User Level' as the user for whom you want to add a domain and click 'Domain Setup'.

DirectAdmin domain setup


Step 2

You will see an overview of your linked domains where you can immediately see the number of subdomains, bandwidth, and disk usage. Click 'Add Another Domain' at the top left.

DirectAdmin add another domain


Step 3

Then enter your domain name and click 'Create'. If you want to add a subdomain, enter the name of your subdomain in its entirety (e.g. subdomain.yourdomain.com).

DirectAdmin create domain

DirectAdmin automatically creates an email address for this domain for the logged in user with the syntax 'username@yourdomain.com'

From now on, when you log into DirectAdmin at 'User Level', you will see an overview of the linked domains, see the example below. You first select the desired domain before you reach the regular 'User Level'.

DirectAdmin multiple domains


Linking multiple domains to one website

 

You may want to have more than one domain on the same website. DirectAdmin uses 'Domain Pointers' for this. In order to use this, the website you want to forward to and the domain you want to forward must be included with the same user.

Step 1

Log in at 'User Level' as the user where the existing website is included. Select the domain where the website is hosted.

DirectAdmin multiple domains

Suppose that, in the example above, you want to have yourdomain.com make use of the website for supporttest.com, then click supporttest.com


 

Step 2

Click 'Domain Pointers' under 'Advanced Feature'.

DirectAdmin domain pointers


 

Step 3

Enter the name of the domain you want to forward. This is yourdomain.com our example in Step 1, click 'Add'.

DirectAdmin domain pointers configuration

The 'Create as an Alias' option is enabled by default. This preserves the name of your domain. So, in our example, when visitors visit yourdomain.com, they actually see yourdomain.com in the browser.

If the 'Create as an Alias' option is not selected, the visitor will see the address of the domain you are redirecting to. In our example, you would see supporttest.com when visiting yourdomain.com.


 

Now that you have linked your domain to your VPS you can set up your website and / or email. Proceed to part 5 for the uploading of your website, database and use of SSL, or continue to part 6 if you only want to set up your email.

Should you have any questions left regarding this article, do not hesitate to contact our support department. You can reach them via the ‘Contact Us’ button at the bottom of this page.

If you want to discuss this article with other users, please leave a message under 'Comments'.

Has this article been helpful?

Create an account or log in to leave a rating.

Comments

Create an account or log in to be able to leave a comment.