Server ManagementIntermediate18 min
How to Install and Configure Apache Web Server
Complete guide to installing Apache HTTP Server and configuring virtual hosts for multiple websites
Introduction
Apache HTTP Server is one of the most popular web servers. This guide covers installation and virtual host configuration.
Step 1: Install Apache
Install Apache web server from the default repository.
sudo apt update
sudo apt install apache2Step 2: Start Apache Service
Enable and start the Apache service.
sudo systemctl start apache2
sudo systemctl enable apache2Step 3: Configure Firewall
Allow HTTP and HTTPS traffic through the firewall.
sudo ufw allow 'Apache Full'Step 4: Create Virtual Host
Create a virtual host configuration for your website.
sudo nano /etc/apache2/sites-available/yourdomain.com.conf
# Add virtual host configuration
sudo a2ensite yourdomain.com.confStep 5: Test Configuration
Test the Apache configuration and reload if successful.
sudo apache2ctl configtest
sudo systemctl reload apache2Conclusion
Apache is now installed and configured with virtual hosts. You can host multiple websites on a single server.
#Apache#Web Server#HTTP#Virtual Hosts#Linux