Apache is free and open-source web server.
It powers most web sites on the internet.


The official Debian repository contains Apache and PHP:
apt-get install apache2 php libapache2-mod-php


When you own a domain (e.g. example.net), you can specify the zone of that domain.
For a web server, the following entries are relevant:

@    IN  A       ; IPv4 address for example.net
@    IN  AAAA   2001:db8:10::1  ; IPv6 address for example.net
www  IN  CNAME  @               ; www.example.net is an alias for example.net
@    IN  CAA    0 issue "letsencrypt.org"


The Certification Authority Authorization (CAA) defines the Certificate Authority (CA)
that is allowed to issue certificates for the domain.

Web Site

A web server can serve many web sites.
Each web site is configured as virtual host on the server:

<VirtualHost *:80>
    ServerName example.net
    ServerAlias www.example.net
    ServerAdmin webmaster@example.net
    DocumentRoot /var/www/example.net
    <Directory /var/www/example.net/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log vhost_combined

When the configuration file of the site is available, the site needs to be enabled:
a2ensite example.net

SSL/TLS Certificate

Install certbot to get a SSL/TLS certificate from Let's Encrypt:
apt-get install certbot python3-certbot-apache

Create and install the certificate:
certbot --apache -d example.net -d www.example.net


Most sites written in PHP (e.g. WordPress, phpMyAdmin, Matomo, ...)
require the following modules, which are part of php-defaults, to be installed:
apt-get install php-curl php-gd php-mbstring php-mysql php-xml php-zip

Additional modules provide better image quality for media uploads:
apt-get install php-imagick

External Links