Kamis, 03 September 2015

Cara Menambahkan Certificate SSL pada ownCloud di Debian 7 Wheezy

Ini adalah tutorial lanjutan dari Cara Install ownCloud di debian 7 wheezy, di tutorial awal menggunakan http saja, belum bisa https (ssl). Ditutorial kali ini saya akan mencontohkan step by step meng-aply-kan ssl untuk ownCloud.

Syarat dan Kondisi:
  1. server sudah terinstall ownCloud server
  2. port 443 tidak dipake untuk aplikasi lain
  3. login ke terminal as root
Step 1: Install Openssl
apt-get install openssl
Step 2: Buat Direktori SSL di folder apache2
 mkdir -p /etc/apache2/ssl
Step 3: Enable SSL dan Rewrite Apachenya
a2enmod ssl
a2enmod rewrite

Step 4: Buat Certificate SSL nya.

openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/owncloud.pem -keyout /etc/apache2/ssl/owncloud.key

Step 5: Buat Config Apache nya.
nano /etc/apache2/conf.d/owncloud.conf
Paste kan text berikut, dengan catan ip adressnya di ganti dengan ip address server ente. Untuk catatan, config di bawah berarti me redirect port 80 (http) ke port 443 (https).
<VirtualHost 192.168.1.34:80>
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>
 
<VirtualHost 192.168.1.34:443>
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/owncloud.pem
SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key
DocumentRoot /var/www/owncloud/
 
<Directory /var/www/owncloud>
AllowOverride All
order allow,deny
Allow from all
</Directory>
</VirtualHost>
Step 6. Restart apachenya.

service apache2 restart
Done! Selesai...

Berikut contoh penampakan nya.....


Note:
jika anda ingin mengaktifkan http dan https secara bersamaan, hapus baris ini di config owncolud apache nya...
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
   Semoga bermanfaat.....