Wednesday, September 3, 2014

Ubuntu : Setup self signed ssl certificate on Owncloud 6 in Ubuntu 14.04 LTS Server

Setup self signed ssl certificate on Owncloud 6 in Ubuntu 14.04 LTS Server

With the arrival of new Ubuntu version 14.04 LTS, there are few changes we have found so far. In my some previous post, I already stated that major change is defualt apache server is version 2.4 . Because we have now Apache 2.4 version, many new configuration parameters are introduced.

Follow the given below steps to setup self signed ssl certificate on Owncloud 6 in Ubuntu 14.04 LTS Server

Step 1 : Install Owncloud 6 on Ubuntu 14.04 LTS

We have already written a post on “How to install Owncloud 6 on Ubuntu 14.04 LTS Server” .
Go through with the post.
Description of our Server
Operating System : Ubuntu 12.04 LTS Server edition
Arch : x86_64
Apache version : 2.4.7
Owncloud Version : 6.0 (or 6.x)
Owncloud DocumetRoot path : /var/www/html/owncloud
Owncloud configuration File Path : /etc/apache2/sites-enabled/owncloud.conf
If you have already setup the owncloud 6 .Then kindly note the following things which may be you have to change as per your set up.
1. DocumentRoot of owncloud
2. Path of Apache Owncloud configuration file

Step 2 : Install OpenSSL package

To create ssl certificate we require OpenSSL package. Hence install it with given below command

Step 3 : Enable ssl and rewrite module

Now enable the two apache module i.e SSL and Rewrite module

Step 4 : Create Self signed Certificate

Now create a self signed certificate to be used in Owncloud setup.
We will first create a seperate directory so that we will keep the SSL keys there
Now use the below given one liner command to create self signed certificate. Write the answers which will asked during certiciate creation
Note: The above certificate is valid for 365 days. We have mentioned validity days in the command.
The below given is reference from my system. Kindly consider it as an example

IP Based Or Name based Virtual Hosting

We have two ways to configure either IP based or Name based. In this tutorial, we are pasting the configuration for both . USE ONLY ONE METHOD EITHER IP BASED OR NAME BASED, DO NOT CONFIGURE BY BOTH METHOD
NOTE: Kindly do the changes as per your server information. Specifically the below given values
1. Domain name = replace example.com with your domain/sub-domain name
2. IP Address = In case, you want to configure IP based. Then use the IP address of your server and replace with 192.168.56.101
3. DocumentRoot = Get the absolute path of Owncloud directory in default Apache’s data dir. In our setup we are using, /var/www/html/owncloud . Hence replace it if yours path is different
4. Owncloud config file = In our setup we have placed the owncloud.conf file in path /etc/apache2/sites-enabled//etc/apache2/sites-enabled/owncloud.conf . Hence check your Owncloud configuration path.

Setup IP Based Apache Configuration

Edit your owncloud configuration file located in Apache’s configuration directory. As we stated earlier, our owncloud.conf file is located in /etc/apache2/sites-enabled/owncloud.conf .
Edit the file /etc/apache2/sites-enabled/owncloud.conf as given below for IP based apache configuration

Now restart apache service

OR Setup Name Based Apache Configuration

For name based we require domain name or sub domain name. In DNS settings resolve the Server IP address to your domain name in host record.
First edit the apache2.conf file and search the parameter HostnameLookups and enable it by replacing off to on
Save and exit from file
Now use the given below settings for Name based apache configuration. Replace example.com with your domain name. Edit the file owncloud.conf file
Save and exit from file

Restart the Apache service

Open the Owncloud URL in web browser

Open the web browser and in address bar type the domain name or IP address . Replace the example.com or 192.168.56.101 with your domain name and server’s ip address.
In configuration we have redirected the traffic coming to port 80 to port 443 . Hence, even using only HTTP in URL it will be redirected to HTTPS
owncloud-ssl-1
owncloud-ssl-2
owncloud-ssl-3-example

No comments: