Apache 2.4 — Installatie, Paden & Mogelijkheden

Overzicht van configuratie, beheer, modules, hardening en best practices.

1. Installatie

Apache installeren op Ubuntu:

sudo apt update
sudo apt install apache2

2. Belangrijke paden

3. Servicebeheer

Apache beheren via systemctl:

sudo systemctl start apache2
sudo systemctl stop apache2
sudo systemctl restart apache2
sudo systemctl reload apache2
sudo systemctl status apache2

Apache’s eigen control interface:

sudo apache2ctl configtest
sudo apache2ctl graceful
sudo apache2ctl fullstatus

4. Modules beheren

Modules inschakelen of uitschakelen:

sudo a2enmod modulenaam
sudo a2dismod modulenaam
sudo systemctl reload apache2

Veelgebruikte modules:

5. Virtual Hosts

Site inschakelen of uitschakelen:

sudo a2ensite sitenaam.conf
sudo a2dissite sitenaam.conf
sudo systemctl reload apache2

Voorbeeld VirtualHost:

<VirtualHost *:443>
    ServerName voorbeeld.nl
    DocumentRoot /var/www/voorbeeld

    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/voorbeeld.crt
    SSLCertificateKeyFile /etc/ssl/private/voorbeeld.key

    <Directory /var/www/voorbeeld>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

6. Logs

Live meekijken:

sudo tail -f /var/log/apache2/error.log

7. SSL/TLS Hardening

Voorbeeld sterke configuratie (A+ SSL Labs):

SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite HIGH:!aNULL:!MD5:!3DES:!RC4
SSLHonorCipherOrder on
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
SSLCompression off
SSLSessionTickets off

8. Mogelijkheden & Uitbreidingen

9. Configuratie testen

sudo apache2ctl configtest

Altijd uitvoeren vóór een reload of restart.