Gernot Walzl

Apache

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

Installation

The official Debian repository contains Apache and PHP:

apt install apache2 php libapache2-mod-php

Domain

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      192.0.2.1       ; 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"

CAA

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:

/etc/apache2/sites-available/example.net.conf
<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
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log vhost_combined
</VirtualHost>

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 install certbot python3-certbot-apache

Create and install the certificate (add all subdomains you might need):

certbot --apache -d example.net -d www.example.net -d mail.example.net

PHP

Most sites written in PHP (e.g. WordPress, phpMyAdmin, Matomo, ...)
require the following modules, which are part of php-defaults, to be installed:

apt install php-curl php-gd php-intl php-mbstring php-mysql php-xml php-zip

Additional modules provide better image quality for media uploads:

apt install php-imagick

External Links

CONTENT.html source 2022-05-22 3.2 KB