Skip to content

HTTPS in Local Network (Ubuntu Server 20.04)

sudo su
openssl req -x509 -days 1 -newkey rsa:2048 -keyout /home/carloz/localhost.key -out /home/carloz/localhost.crt

Enter PEM pass phrase: misal 1234 (antara 4 - 1024 character)
country name : ID
state or province : Jawa Tengah
locality name : Kudus
organization name : AUWO
organizational unit name : AUWO2
common name : ganteng
email addr : carloz@ganteng.com

vim /etc/apache2/sites-available/https.conf

isi dengan :

<VirtualHost *:443>
ServerName 127.0.1.1
DocumentRoot /var/www/html
SSLEngine on
SSLCertificateFile "/home/carloz/localhost.crt"
SSLCertificateKeyFIle "/home/carloz/localhost.key"
<Directory /var/www/html>
    AllowOverride all
</Directory>
</VirtualHost>
a2ensite https.conf
systemctl reload apache2

cek status :

systemctl status apache2.service

jika ada error, silahkan oprec2 sendiri
misal error "Invalid command 'SSLEngine', blablablaa....", seperti gambar :

hehe:)

maka dapat dengan :

a2enmod ssl

lalu setelah error hilang :

systemctl restart apache2

enter passphrase : 1234

done

systemctl status apache2.service

buka web browser, masukkan https://localhost/ atau https://ip/
jika ada warning, tinggal klik advanced..., accept the risk and continue

suatu ketika kok terjadi loading lama di web, coba

systemctl restart apache2

masukkan kode rsa nya '1234'