How to Setup OwnCloud Server 5 with SSL Connection

In How To 2320 views

Today ownCloud is the best cloud storage and useful alternative to Dropbox or other file-hosting services. it free open source software and allowing you to have own cloud server in your home.

I previously wrote about step by step installing ownCloud 5 in ubuntu server 12.10. In this brief guide i will shown you Owncloud server 5 work with SSL/Https Connection.

Step by Step Configure OwnCloud Server 5 with SSL Connection

Step 1: Make sure ownCloud server 5 is installed correctly, you can see guide how to install ownCloud 5 here, Login to ubuntu server via ssh then switch to root mode.

sudo -i

Step 2: Editing file /etc/apache2/sites-enabled/000-default,  change “AllowOverride None” to “AllowOverride All”

nano /etc/apache2/sites-enabled/000-default

Step 3. you need to enable apache module mod_rewrite, mod_headers and mod_ssl, to enable both module use following command:

a2enmod rewrite && a2enmod headers && a2enmod ssl

Restart apache2 daemon:

service apache2 restart

Step 4. On this step you need to editing file configuration /etc/ssl/openssl.cnf,

nano /etc/ssl/openssl.cnf

Find and change the following line:

dir = /root/SSLCertAuth
default_days = 3650 # 10 years
default_bits = 2048 # recommended by NSA until 2030
countryName_default = US
0.organizationName_default = Ubuntu Contrib

Step 5. Create Directory for save all file SSL Certificate Authority, on this case I will make directory name “SSLCertAuth”

mkdir /root/SSLCertAuth
chmod 700 /root/SSLCertAuth
cd /root/SSLCertAuth
mkdir certs private newcerts
echo 1000 > serial
touch index.txt

Step 6. Run the following command to generating Certificate Authority (CA)

openssl req -new -x509 -days 3650 -extensions v3_ca \
-keyout private/cakey.pem -out cacert.pem \
-config /etc/ssl/openssl.cnf


owncloudssl - generating Certificate Authority

If you want to keep the default value, Hit [enter]

Step 7. Creating Certificate Signing Request

openssl req -new -nodes \
 -out apache-req.pem \
 -keyout private/apache-key.pem \
 -config /etc/ssl/openssl.cnf


owncloud SSL - Creating Certificate Signing Request

Step 8. Generate the certificate then copy the files to directory /etc/ssl :

openssl ca \
-config /etc/ssl/openssl.cnf \
-out apache-cert.pem \
-infiles apache-req.pem


owncloud SSL - Certificate Authority

mkdir /etc/ssl/crt
mkdir /etc/ssl/key
cp /root/SSLCertAuth/apache-cert.pem /etc/ssl/crt
cp /root/SSLCertAuth/private/apache-key.pem /etc/ssl/key

Step 9. This final step W’ll to Configure HTTPS apache2 web server, create directory SSL log and create new file /etc/apache2/conf.d/owncloud5-ssl.conf to add the SSL virtualhost.

nano /etc/apache2/conf.d/owncloud5-ssl.conf

copy and paste this configuration:

<VirtualHost *:443>
      SSLEngine on
      SSLCertificateFile /etc/ssl/crt/apache-cert.pem
      SSLCertificateKeyFile /etc/ssl/key/apache-key.pem
      DocumentRoot /var/www/owncloud
      CustomLog /var/www/logs/ssl-access_log combined
      ErrorLog /var/www/logs/ssl-error_log

Note: on this case my IP server, you can replace IP with your server hostname or domain

service apache2 restart

you now have secured, access owncloud using your favorite browser by typing on addressbar , it will appear like following screenshot

Link Reference:


Tags: #HTTPS #OwnCloud 5 #SSL #Ubuntu Server 12.04 #Ubuntu Server 12.10

How to Upgrade Ubuntu Server 12.04 to Ubuntu Server 14.04 LTS
How to Upgrade Ubuntu Server 12.04 to Ubuntu Server 14.04 LTS
This tutorial will describes how to upgrade
How to Install OwnCloud 5 in Ubuntu Server 12.10
How to Install OwnCloud 5 in Ubuntu Server 12.10
OwnCloud 5 has been released and announced
Must read×