1. Install OpenSSL dan SSL-Cert


  #  apt-get install  openssl

 

  #  apt-get install ssl-cert


2.Aktifkan modul SSL

   # a2enmod ssl


 3. Restart Service Apache2

   #  /etc/init.d/apache2 restart


 4. Buat Folder untuk menyimpan Server Key dan Sertificat

     # mkdir /etc/apache2/ssl


 5. Membuat Certificat SSL

    # openssl req -x509 -nodes -days 730 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt



    Outputnya adalah seperti berikut:

    You are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.
    -----
    Country Name (2 letter code) [AU]:ID

    State or Province Name (full name) [Some-State]:Jawa Tengah

    Locality Name (eg, city) []: Klaten

    Organization Name (eg, company) [Internet Widgits Pty Ltd]: Skawan Team

    Organizational Unit Name (eg, section) []: Skawan Common

    Name (e.g. server FQDN or YOUR name) []:smkngawen.edu

    Email Address []:[email protected]


6. Karena kita mengaktifkan 2 metode, HTTP dan HTTPS. Jadi kita lupakan HTTP, karena ini sudah pasti akan berfungsi seperti seharusnya. Komponen apache yang menunjukkan dimana letak website kita disimpan ada pada file default. Ini berada di /etc/apache2/sites-available/default. Itu adalah salah satu komponen apache yang menunjukkan letak alamat website kita. Secara default file ini merujuk ke /var/www/. Didalam /etc/apache2/sites-available/ terdapat 2 buah file, yang satu adalah file default tadi, dan yang kedua adalah default-ssl.conf.Kita akan fokus pada file default-ssl.conf.

  #  vi /etc/apache2/sites-available/default-ssl.conf



    <VirtualHost _default_:443>

    ServerAdmin [email protected]

    ServerName smkngawen.edu

    DocumentRoot /var/www/


    # Tambahkan baris ini di file default-ssl anda di bawah DocumentRoot

    SSLEngine On

    SSLCertificateFile      /etc/apache2/ssl/apache.crt

    SSLCertificateKeyFile   /etc/apache2/ssl/apache.key


7. Selanjutnya cari baris ini dan berikan tanda comment (#)

    # SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
    # SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key


8. Aktifkan Website default-ssl

   # a2ensite default-ssl.conf


9. Restart Apache2

   # /etc/init.d/apache2 restart