Panduan Instalasi Sertifikat Let's Encrypt (Produksi) untuk Apache (XAMPP/Linux) Langkah 1

 🔐 Panduan Instalasi Sertifikat Let's Encrypt (Produksi) untuk Apache (XAMPP/Linux)
Langkah 1: Install Certbot


sudo apt update
sudo apt install certbot python3-certbot-apache

Langkah 2: Dapatkan Sertifikat Let's Encrypt


sudo certbot certonly --manual --preferred-challenges dns -d sub.domain.com

Ikuti instruksi yang muncul. Anda akan diminta menambahkan DNS TXT record:

    Name:

_acme-challenge.sub.domain.com.

Type:

TXT

Value (contoh dari certbot):

    7F4rb3Oz1BrAemrhDDHJGcIlItYc9kXcJRnAVhebLog

🕒 Tunggu propagasi DNS, lalu verifikasi TXT record sudah aktif menggunakan Google Admin Toolbox

Jika berhasil, Anda akan melihat pesan:

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/sub.domain.com/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/sub.domain.com/privkey.pem

⚠️ Catatan

    Sertifikat manual tidak diperpanjang otomatis.

    Untuk perpanjangan, ulangi perintah certbot dan proses DNS challenge.

Langkah 3: Konfigurasi Apache (XAMPP)


Contoh konfigurasi VirtualHost SSL:

Edit file:

sudo nano /opt/lampp/etc/extra/httpd-ssl.conf

Tambahkan atau sesuaikan:

<VirtualHost *:443>
    ServerName sub.domain.com
    DocumentRoot "/opt/lampp/htdocs/subdomain"

    SSLEngine on
    SSLCertificateFile "/etc/letsencrypt/live/sub.domain.com/fullchain.pem"
    SSLCertificateKeyFile "/etc/letsencrypt/live/sub.domain.com/privkey.pem"

    <Directory "/opt/lampp/htdocs/subdomain">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName sub.domain.com
    Redirect permanent / https://sub.domain.com/
</VirtualHost>

Langkah 4: Aktifkan Modul SSL Apache


Edit file:

sudo nano /opt/lampp/etc/httpd.conf

Pastikan baris berikut tidak dikomentari (tidak diawali #):

LoadModule ssl_module modules/mod_ssl.so
Include etc/extra/httpd-ssl.conf

Langkah 5: Restart Apache


sudo /opt/lampp/lampp restart

Langkah 6: Uji Sertifikat


Buka browser dan akses:

https://sub.domain.com

Jika menggunakan sertifikat valid dari Let's Encrypt, tidak akan ada peringatan keamanan dari browser.