Apache2 SSL mit Let's Encrypt
Lerne, wie du deinen Apache2-Webserver mit einem kostenlosen SSL-Zertifikat von Let's Encrypt absicherst.
Learn how to secure your Apache2 web server with a free SSL certificate from Let's Encrypt.
Certbot installieren
Install Certbot
Installiere Certbot und das Apache-Plugin, um automatisch SSL-Zertifikate zu erhalten und zu konfigurieren.
Install Certbot and the Apache plugin to automatically obtain and configure SSL certificates.
sudo apt update
sudo apt install certbot python3-certbot-apacheSSL-Zertifikat beantragen
Obtain SSL Certificate
Fordere ein SSL-Zertifikat für deine Domain an. Certbot konfiguriert Apache automatisch.
Request an SSL certificate for your domain. Certbot will automatically configure Apache.
sudo certbot --apache -d domain.comErsetze domain.com mit deiner eigenen Domain. Certbot fragt nach deiner E-Mail-Adresse und ob du HTTP auf HTTPS umleiten möchtest.
Replace domain.com with your own domain. Certbot will ask for your email address and whether you want to redirect HTTP to HTTPS.
HTTPS überprüfen
Verify HTTPS
Öffne deinen Browser und navigiere zu https://domain.com. Du solltest ein gültiges SSL-Zertifikat sehen (Schloss-Symbol in der Adressleiste).
Open your browser and navigate to https://domain.com. You should see a valid SSL certificate (lock icon in the address bar).
Du kannst auch folgenden Befehl verwenden, um die Konfiguration zu testen:
You can also use the following command to test the configuration:
sudo apache2ctl configtestAutomatische Erneuerung prüfen
Check Auto-Renewal
Let's Encrypt-Zertifikate sind 90 Tage gültig. Certbot richtet automatisch einen Timer für die Erneuerung ein.
Let's Encrypt certificates are valid for 90 days. Certbot automatically sets up a timer for renewal.
sudo systemctl status certbot.timerErneuerung testen
Test Renewal
Teste die automatische Erneuerung mit einem Trockenlauf, um sicherzustellen, dass alles funktioniert.
Test the automatic renewal with a dry run to make sure everything works correctly.
sudo certbot renew --dry-runWenn der Test erfolgreich ist, werden deine Zertifikate automatisch erneuert, bevor sie ablaufen. ✅
If the test succeeds, your certificates will be automatically renewed before they expire. ✅