Complete Guide to Apache Web Server Setup - Installation and Configuration Tutorial
Server

Complete Guide to Apache Web Server Setup - Installation and Configuration Tutorial

  • Author :Liam K.
  • Date :March 12, 2025
  • Time :15 minutes

What is Apache?

Apache is the world's most popular web server software, powering approximately 40% of all websites. It's known for its reliability, security and extensive feature set.

Prerequisites

  • A Linux server (Ubuntu, Debian, CentOS)
  • Root or sudo access
  • Basic command line knowledge
  • Domain name (optional)

Installation

Update your package list and install Apache:

bash
sudo apt update
sudo apt install apache2

Basic Configuration

Enable required Apache modules:

bash
sudo a2enmod rewrite
sudo a2enmod ssl
sudo systemctl restart apache2

Virtual Hosts

Create a new virtual host configuration file in the sites-available directory:

bash
sudo nano /etc/apache2/sites-available/example.conf

SSL Configuration

Install Certbot and obtain SSL certificate:

bash
sudo apt install certbot python3-certbot
sudo certbot --apache -d example.com

PHP and MariaDB

Install PHP and MariaDB:

bash
sudo apt install php libapache2-mod-php php-mysql
sudo apt install mariadb-server
sudo mysql_secure_installation

"Apache's versatility and robust ecosystem make it the perfect foundation for your web hosting needs. With proper configuration and security measures, you can build a reliable and high-performance web server that scales with your applications."

Technical Author

Technical Author - Liam K.
Liam K.

System administrator and technical writer specializing in server infrastructure, security and deployment. Creating comprehensive guides to help you master server administration.