Skip to main content
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Former Employee

How To Setup Multiple 3rd Party Domains To One VPS Account - Tutorial

Antonyw1969 wrote,

“While I'm waiting for my primary domain to transfer in I'm trying to do my homework on setting up 3 new clients website who will all keep their domains registered with their current provider but I will host their websites. Question: A(Host) record IP update, understood but how does my VPS know which folder to send each domain to?.. example: someone types into their browser and they find their way to my IP address but then how will they find their way to the correct folder?”


Oslinux replied,

“Once the domain has been pointed to your VPS's server you will need to configure your web server for the domain. Since the most common web server is Apache I will post a sample config:

<VirtualHost oslinux:80>
   DocumentRoot /var/www/html/  

  <Directory "/home/oslinux/public_html">

     Options Indexes FollowSymLinks

     AllowOverride ALL

     Require all granted


  DirectoryIndex index.html
   ErrorLog logs/error.log
   CustomLog logs/access.log combined

In the config above replace with the domain you want to serve.

Server Alias is not needed and used if you want several subdomains/domains pointing to the same location like adding www to your domain.  

Server Admin should be your email address

DocumentRoot should point to the folder for the domain (Apache's default location is /var/www/html Recommended to create a folder with the same name as the domain to make managing it easier. You can use other locations for the folders but make sure your Apache user has read access to the location. If you are using a different folder than the default you will need to include the

<Directory "/home/oslinux/public_html"> </Directory> section only needs to be added in you are using a different directory, replace /home/oslinux/public_html with the location for the domain.

I would recommend you create separate configs for each domain and name the file to match the domain and add .conf to the end

The default location for Apache config files is

Fedora based Distros "/etc/httpd/conf.d"

Debian based Distros "/etc/apache2/sites-available"

Here are some guides for creating virtual hosts.

Debian Based:

Fedora Based:

Apache docs on virtual hosts.

If I answered your question, please mark it as the solution or give it a "Kudo"