How to Run Multiple Websites Using Ubuntu Virtual Hosts

When running multiple websites, buying separate servers can be costly and unnecessary. With an Ubuntu Virtual Host, you can host multiple domains on a single server instance, saving money while improving efficiency.

For startups and businesses in India, this is especially useful — it offers scalability, flexibility, and professional management without overspending. Before diving in, check out our guide on how to choose the right hosting plan for your website to ensure you pick the correct setup.

What is an Ubuntu Virtual Host?

An Ubuntu Virtual Host is a configuration that allows one physical server (or VPS) to serve multiple websites. Each website can have its own:

  • Domain name
  • Root directory
  • Configuration settings

This is particularly helpful for agencies, developers, or entrepreneurs managing multiple projects.

Benefits of Using Ubuntu Virtual Host

  1. Cost-Effective Hosting – Instead of paying for multiple servers, run all sites on one.
  2. Centralized Management – Easier to update, monitor, and secure.
  3. Scalability – Add new websites without additional hardware.
  4. Professional Flexibility – Ideal for freelancers and businesses growing online.

If you’re considering hosting on WordPress, explore our guide on how to host a website on WordPress for a smoother setup.

How to Configure Ubuntu Virtual Host (Step-by-Step)

Step 1: Update Server Packages

sudo apt update
sudo apt upgrade

Step 2: Install Apache

sudo apt install apache2

Step 3: Create Directories for Your Websites

sudo mkdir -p /var/www/domain1.com/public_html
sudo mkdir -p /var/www/domain2.com/public_html

Step 4: Assign Permissions

sudo chown -R $USER:$USER /var/www/domain1.com/public_html

Step 5: Create Sample Index Files

echo "<h1>Welcome to Domain1.com</h1>" > /var/www/domain1.com/public_html/index.html

Step 6: Configure Virtual Host Files

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

Example configuration:

<VirtualHost *:80>
   ServerAdmin admin@domain1.com
   ServerName domain1.com
   ServerAlias www.domain1.com
   DocumentRoot /var/www/domain1.com/public_html
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Step 7: Enable Virtual Hosts

sudo a2ensite domain1.com.conf
sudo systemctl reload apache2

Step 8: Test Configuration

Run:

sudo apache2ctl configtest

If everything is correct, restart Apache.

Best Practices for Ubuntu Virtual Host

Ubuntu Virtual Host vs Free Hosting

While free hosting may seem tempting, it lacks security and scalability. Setting up your own Ubuntu Virtual Host gives you complete control, unlike limited options in free hosting a website and domain.

Conclusion

Configuring an Ubuntu Virtual Host allows businesses and developers to efficiently run multiple websites from a single server. It’s cost-effective, scalable, and secure, making it one of the best hosting practices for growing digital projects.

If you’re ready to expand your online presence, setting up an Ubuntu Virtual Host is a smart investment.