Time to host your applications on cloud. Join Now
Apaches Virtual Hosts serve as the most effective way to host more than one website on a single computer. They help you to sign up on and operate multiple domains and control them with specific configurations either easily or professionally.
We'll approach this task by following each step of the process one at a time, beginning with setting up Apache Virtual Hosts on Ubuntu 20. 04.
Let’s get started!
1. Prerequisites:
First ensure that you have:
Access to an Ubuntu 20.04 server with Apache installed.
Administrative privileges or access to the sudo command.
2. Verify Apache Installation:
First, ensure that Apache is installed and running on your Ubuntu server by executing the following command:
If Apache is not installed, you can install it using:
3. Create Directory Structure:
Next, create a directory structure to store your website files. We'll create a directory for each virtual host:
4. Grant Permissions:
Assign ownership of the directories to your user:
5. Create Sample HTML Files:
Create sample HTML files for each website:
6. Create Virtual Host Files:
Create virtual host configuration files for each domain:
7. Edit Virtual Host Files:
Open the virtual host files in a text editor:
Replace the content with:
Repeat the process for test.com.conf, replacing example.com with test.com.
8. Enable Virtual Hosts:
Enable the virtual hosts:
Copy code
sudo a2ensite example.com.conf
sudo a2ensite test.com.conf
9. Disable Default Site:
Disable the default site:
10. Restart Apache:
Restart Apache to apply the changes:
Congratulations! You have managed to do the ASVS (Apache Virtual Hosts) service installation on your local Ubuntu 20. 04 server. Server now allows you to use the multi-user functionality for easy one-server configuration and each one of them could have its own domain and setup.
Such a powerful feature of Apache makes it possible to quickly and seamlessly conduct requirements for different projects that may host multiple websites at the same time. As a consequence, it is crucial for any web server administrator to master this skill. For more information-contact our VPS Hosting India experts today!
Let’s talk about the future, and make it happen!