Apache Port-Based Virtual Hosting (Step-by-Step Guide)

 

Apache Port-Based Virtual Hosting (Step-by-Step Guide)

Johnmohan
2 min readFeb 22, 2026

Port-based virtual hosting allows you to serve multiple websites using different port numbers on the same server IP.

Step 1: Install Apache

Update your system and install Apache:

sudo apt install apache2

Check the status:

sudo systemctl status apache2

Enable Apache to start on boot:

sudo systemctl enable apache2

Step 2: Configure Apache Ports

Edit the ports configuration file:

sudo vim /etc/apache2/ports.conf

Add the following lines:

Listen 8080
Listen 8081

Save and exit: :wq!

Step 3: Create Website Directories

Create directories for both sites:

sudo mkdir /var/www/html/8080
sudo mkdir /var/www/html/8081

Step 4: Create Index Files

Post a Comment

0 Comments