Hi KincaiHostingns! This time, we will explain how to connect multiple domains to a VPS or what is commonly referred to as multiple hosts / multiple websites. What does it do? If you only have a domain and a VPS, then no problem! You can put each website file on the VPS, then connect the domain to the VPS. What if you have multiple websites? For example, you have 2 domains / subdomains:
domain 1: a .com
domain 2: b. net
Then you want to point the two domains to the VPS and put the website files on the VPS. Can it? Can! Please follow the guide on how to connect multiple domains to the following vps.

Preparation phase

  1. Make sure you know how to remote VPS via SSH. Because all settings will be done via the console. As for how, please read how to remote VPS .
  2. Prepare 2 domains / subdomains that you want to redirect to the VPS along with the website files. What if you want to redirect multiple domains / subdomains? Can also! You only need to prepare the domain name and subdomain. If you don't understand how to create a subdomain, please read How to Create Subdomains in the Client Area .
  3. Make sure you have installed the web server on the VPS. You can use Apache or Nginx by following How to Install a Web Server on a VPS

How to Connect Multiple Domains to a VPS

The ways to connect multiple domains to a VPS include:

1. Setting NameServer On Main Domain

Make sure you have set the main domain with the default nameserver. To set the nameservers, please enter the client area ( my.domainesia.com ). Then select the Domains menu then select a domain name. In the Nameservers menu, please select Use default nameservers. Note, each user can have a different nameserver!

2. VPS access via SSH

As for how to access VPS via SSH, please follow the remote VPS method via SSH. Make sure you access SSH on the VPS using the root login, OK!

3. Enter the Website File to the VPS

Now it's time to enter the desired website files into the VPS. You must enter the websie file in the / var / www / html / folder. To make it easier, you can compress the website files into .zip first.

If you want to move files from a Linux-based computer / from Hosting to a VPS, you can use the command

 

scp path_direktori_folder_asal root@IP_VPS:/var/www/html/

If you are using Windows, please use the command at the command prompt as follows,

 

winscp path_direktori_folder_asal root@IP_VPS:/var/www/html/

4. Enabling VirtualHost on Apache

Please write

 

nano /etc/apache2/apache2.conf

then search for writing

 

IncludeOptional sites-enabled/*.conf

make sure there is no hashtag (#) before IncludeOptional sites-enabled / *. conf

5. Adding Domain to VPS

You can add a domain to a VPS via 2 sides, namely the domain side and the web server side.
For the domain side,
please point the domain to the VPS IP via the Zone Editor menu. Please follow How to Redirect Subdomain / Domain to a Different IP . Select the domain then select A record and add the VPS IP Address.

For the web server side
Domain1.conf is the setting file for domain 1. If you want to add domain 2, then later you have to add domain2.conf.
Now, add the domain1.conf settings file first by,

 

nano /etc/apache2/sites-available/domain1.conf

Then fill in the following text:

 

<VirtualHost *:80>

DocumentRoot /var/www/html/nama_folder_website

ServerName namadomainkamu

ServerAlias www.namadomainkamu# enter other directives here, e.g. :Options FollowSymLinks

AllowOverride All

Order allow,deny

allow from all</Directory>ErrorLog /var/log/apache2/namadomainkamu-error_log

CustomLog /var/log/apache2/namadomainkamu-access_log common</VirtualHost>

After that, don't forget to save!

Now, add the domain2.conf file with the following command,

 

nano /etc/apache2/sites-available/domain2.conf

Then fill it with writing like the following,

 

<VirtualHost *:80>

DocumentRoot /var/www/html/nama_folder_website

ServerName namadomainkamu

ServerAlias www.namadomainkamu

</VirtualHost>

Then don't forget to save!

6. Enabling domain1.conf and domain2.conf

You must activate the domain1.conf and domain2.conf files first. To activate it, please write the following command,

 

ln -s /etc/apache2/sites-available/domain1.conf /etc/apache2/sites-enabled/domain1.conf

ln -s /etc/apache2/sites-available/domain2.conf /etc/apache2/sites-enabled/domain2.conf

or use this command,

 

sudo a2ensite domain1.conf

sudo a2ensite domain2.conf

7. Manage Website File Ownership

In order for the website files entered in / var / www / html / earlier to be read by the web server, please change their ownership first. Please write the following command,

 

chown www-data:www-data -R /var/www/html/nama_folder_website*

If there are 2 website folders, then do the command for each website file.

8. Restart Apache

Now it's time for you to restart Apache by the way

9. Domain Can Connect with VPS

Yeay! Finally, the domain can be connected to the VPS. So, now you can add multiple website files to your VPS and then point them to their respective domains.

 

Conclusion

It is very easy to connect multiple domains to a VPS. What you need to note is that the domain must be pointing to the VPS first. Then enter the website files into the / var / www / html / folder. Only then the Apache configuration file settings. If you have any questions, please don't hesitate to ask us. The KincaiHosting Support Team will be happy to help you 🙂 Already have a domain and cheap VPS , then want to add to your Hosting collection? Quiet! You can order cheap hosting at KincaiHosting! There are various cheap hosting packages that you can choose from!

What is Safelink Asia?

Safelink.asia is a completely free tool where you can create short links. URL security with cryptographic algorithm. Protect your web visitors with a secure link, to avoid viruses, malware, thief, etc. Apart from being free, you get paid! Register now!


Shorten URLs & earn money

So, now you can make money from home, when managing and protecting your links with Safelink Asia. Signup for an account in just 1 minutes. Once you've completed your registration just start creating short URLs and sharing the links with your family and friends. See our proof of payment and publisher rate.


Our partners and network

Here are some of our partners and networks that have collaborated on advertising: 401XD Group, MC Project, Kincai Media, Kartu Nama Digital, SEO Secret Indonesia, Safelink Asia, Media Bisnis, Blackexpo, Adigunawan.net.