Cara install SSL di Jaringan Lokal: Difference between revisions

From Dboswiki
Jump to navigation Jump to search
Line 13: Line 13:


  Kemudian, ubah konfigurasi file tersebut seperti contoh di bawah ini:
  Kemudian, ubah konfigurasi file tersebut seperti contoh di bawah ini:
<IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin webmaster@localhost ServerName nama-domain-anda DocumentRoot /var/www/html SSLEngine on SSLCertificateFile /etc/ssl/certs/nama-domain-anda.crt SSLCertificateKeyFile /etc/ssl/private/nama-domain-anda.key <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 # MSIE 7 and newer should be able to use keepalive BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown </VirtualHost>
<IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin webmaster@localhost ServerName nama-domain-anda DocumentRoot /var/www/html SSLEngine on SSLCertificateFile /etc/ssl/certs/nama-domain-anda.crt SSLCertificateKeyFile /etc/ssl/private/nama-domain-anda.key <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> BrowserMatch "MSIE [2-6]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 # MSIE 7 and newer should be able to use keepalive BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown </VirtualHost>
  </IfModule>
  </IfModule>



Revision as of 15:57, 26 February 2023

Instal OpenSSL: Pertama, pastikan OpenSSL sudah terinstal pada server Ubuntu dengan menjalankan perintah berikut di terminal:

sudo apt-get update
sudo apt-get install openssl

Buat Sertifikat SSL: Selanjutnya, buat sertifikat SSL menggunakan perintah berikut di terminal:

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nama-domain-anda.key -out /etc/ssl/certs/nama-domain-anda.crt

Pastikan untuk mengganti nama-domain-anda dengan nama domain yang ingin Anda gunakan. Selain itu, pastikan juga untuk mengisi informasi yang diminta saat menjalankan perintah tersebut.

Configurasi Apache2: Setelah membuat sertifikat SSL, konfigurasikan Apache2 agar dapat menggunakan SSL. Buka file konfigurasi default dengan perintah berikut di terminal:

sudo nano /etc/apache2/sites-available/default-ssl.conf
Kemudian, ubah konfigurasi file tersebut seperti contoh di bawah ini:
<IfModule mod_ssl.c>	<VirtualHost *:443>		ServerAdmin webmaster@localhost		ServerName nama-domain-anda		DocumentRoot /var/www/html		SSLEngine on		SSLCertificateFile /etc/ssl/certs/nama-domain-anda.crt		SSLCertificateKeyFile /etc/ssl/private/nama-domain-anda.key		<FilesMatch "\.(cgi|shtml|phtml|php)$">			SSLOptions +StdEnvVars		</FilesMatch>		<Directory /usr/lib/cgi-bin>			SSLOptions +StdEnvVars		</Directory>		BrowserMatch "MSIE [2-6]" \			nokeepalive ssl-unclean-shutdown \			downgrade-1.0 force-response-1.0		# MSIE 7 and newer should be able to use keepalive		BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown	</VirtualHost>
</IfModule>


Pastikan untuk mengganti nama-domain-anda dengan nama domain yang ingin Anda gunakan. Setelah mengubah konfigurasi, simpan dan keluar dari editor.

Aktifkan modul SSL dan Konfigurasi Default: Aktifkan modul SSL dan konfigurasi default dengan menjalankan perintah berikut di terminal:

sudo a2enmod ssl
sudo a2ensite default-ssl.conf
sudo systemctl restart apache2