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

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

  • AuthorBen H.
  • Date
  • Time15 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

Ben H.

Ben H.

Rack, remote hands, and logistics in the datacenter. Writes when the job is hardware, hands on site, and getting gear in place.