
A VPS (Virtual Private Server) gives you full control of your hosting environment, making it possible to run more than one website on the same server. This is a cost-effective and efficient solution for developers, freelancers, and businesses managing multiple projects.
In this tutorial, we’ll walk you through the steps to host multiple websites on a single VPS.
✅ Prerequisites
- A VPS with root access (you can get one from Hosteons VPS Plans)
- A domain name for each website you want to host
- Basic knowledge of Linux commands
🔹 Step 1: Update Your Server
Keep your VPS up to date with the latest security patches.
apt update && apt upgrade -y # For Ubuntu/Debian
yum update -y # For CentOS/AlmaLinux
🔹 Step 2: Install a Web Server
Choose between Apache or Nginx.
For Apache:
apt install apache2 -y # Ubuntu/Debian
yum install httpd -y # CentOS/AlmaLinux
For Nginx:
apt install nginx -y
yum install nginx -y
🔹 Step 3: Set Up Directories for Each Website
Create separate folders for your websites. Example:
mkdir -p /var/www/site1.com/public_html
mkdir -p /var/www/site2.com/public_html
Assign permissions:
chown -R www-data:www-data /var/www/*
chmod -R 755 /var/www/*
🔹 Step 4: Configure Virtual Hosts
For Apache, create a new config file for each domain:
nano /etc/apache2/sites-available/site1.com.conf
Add:
<VirtualHost *:80>
ServerName site1.com
DocumentRoot /var/www/site1.com/public_html
</VirtualHost>
Enable the site:
a2ensite site1.com.conf
systemctl reload apache2
For Nginx, edit the server block:
nano /etc/nginx/sites-available/site1.com
Add:
server {
listen 80;
server_name site1.com;
root /var/www/site1.com/public_html;
}
Enable it:
ln -s /etc/nginx/sites-available/site1.com /etc/nginx/sites-enabled/
systemctl reload nginx
Repeat for each domain.
🔹 Step 5: Update DNS Records
Point each domain’s A record to your VPS IP address in your domain registrar’s DNS settings.
🔹 Step 6: Enable SSL with Let’s Encrypt
Install Certbot:
apt install certbot python3-certbot-apache -y # Apache
apt install certbot python3-certbot-nginx -y # Nginx
Issue an SSL certificate:
certbot --apache -d site1.com -d www.site1.com
certbot --nginx -d site2.com -d www.site2.com
🔹 Step 7: Test Your Setup
Visit your domains in a browser to confirm they are loading correctly and secured with HTTPS.
✅ Conclusion
With a VPS from Hosteons, you can host multiple websites easily by setting up virtual hosts or server blocks, configuring DNS, and enabling SSL. This lets you manage multiple projects on a single server while saving costs and maintaining flexibility.
👉 Get started with a VPS today: https://hosteons.com