How to configure self signed SSL certificate in owncloud Ubuntu

Before directly jumping into this tutorial you must have running owncloud server in your system.
I have written it in my previous post,you can learn how to from this link https://sharadchhetri.com/installing-owncloud-in-ubuntu-13-04/

In this tutorial we will learn how to configure self signed ssl certificate in owncloud.
The method is applied to apache2 no matter it is Debian or Ubuntu.If still you have any doubt leave the comment.

To configure the Self Signed Certificate follow the given below steps.

Step(1) Install openssl in server as we have already running owncloud hence installing of apache2 is not required.

$ sudo apt-get install openssl

Step(2) Enable the ssl and rewrite module in apache2

$sudo su -
#a2enmod ssl
#a2enmod rewrite

Step(3): Create a ssl directory inside /etc/apache2

# mkdir -p /etc/apache2/ssl

Step(4): Create self signed ssl certificate. And fill information which it will ask.

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

Now we will configure the owncloud.conf file.

Step (5): Edit the owncloud.conf file
In owncloud.conf file I redirect port 80 request to port 443.
Configured the SSL engine and its key path. And the DocumentRoot parameter is also used.

Note: In the below given configuration I am using IP based Virtual Hosting in apache. If you have DNS configured you can set it as name based configuration also.

Replace 192.168.1.34 with you server IP address

vi /etc/apache2/conf.d/owncloud.conf

RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]

 

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/owncloud.pem
SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key
DocumentRoot /var/www/owncloud/
 

AllowOverride All
order allow,deny
Allow from all


Step (6) Restart the apache2.

service apache2 restart

Step(7) Open the webbrowser and type the url of owncloud you will see it by defualt goes to https.
If you want both http and https then remove the redirection at para of “VirtualHost *:80 …. </VirtualHost> “

 

 

owncloud1

owncloud2

owncloud3

Read Some More Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.