• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

Setup Owncloud 6 with self signed SSL certificate on Ubuntu 13.10

March 9, 2014 by Sharad Chhetri 17 Comments

In this tutorial, we will setup Owncloud 6 with self signed SSL certificate on Ubuntu 13.10 Server.In other words,setting HTTPS for Owncloud 6 in Ubuntu 13.10 Server.In recent months, Owncloud 6 has been released.In our last post,we have already written document on “how to install Owncloud 6 in Ubuntu 13.10 Server“.Hence, we expect,you have already setup the Owncloud 6.x on Ubuntu 13.10 Server.

IMPORTANT NOTE : There is a one major difference in Ubuntu 13.10 Server is,it is shipped with by-default Apache version 2.4. Hence,we have to configure the Apache as per version 2.4 .

Follow the given below steps, to setup Owncloud 6 with self signed SSL certificate/HTTPS on Ubuntu 13.10 Server

Step 1 : Install the OpenSSL package in the Server.This package is important to install,it helps to generate the SSL certificate.

sudo apt-get install openssl

Step 2 : Enable the SSL and Rewrite module in Apache 2.4 .

sudo a2enmod ssl
sudo a2enmod rewrite

Step 3: Now create the directory for SSL Certificates which will be generated with the help of command openssl.

sudo mkdir -p /etc/apache2/ssl

Step 4 : Generate Self Signed Certificate by using below given command.

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

Step 5: Configure Apache 2.4 Webserver in Ubuntu 13.10 Server(By-default in Ubuntu 13.10 Server edition, apache version 2.4 is shipped)

Note: There are some changes have been found in Apache 2.4 version related to configuration.

In previous post of setup Owncloud 6 in Ubuntu 13.10 Server,we are using /etc/apache2/conf.d/owncloud.conf file. Hence, we will edit the /etc/apache2/conf.d/owncloud.conf .
In case,you have owncloud configuration file in other path then edit that particular file.

Description of our Server

Operating System : Ubuntu 13.10 Server edition
Arch : x86_64
Apache version : 2.4
Owncloud Version : 6.0 (or 6.x)

Owncloud DocumetRoot path : /var/www/owncloud
Owncloud configuration File Path : /etc/apache2/conf.d/owncloud.conf

NOTE: We have written both IP based and Name based Virtual Host Apache configuration. Use anyone method as per your requirement

IP Based VirtualHost Apache configuration for https in Owncloud Server

(A) Edit apache2.conf file : Edit /etc/apache2/apache2.conf file.
And add the line IncludeOptional conf.d/*.conf at the end of file

sudo vi /etc/apache2/apache2.conf
### paste below given lines,at the end of file apache2.conf ###3

IncludeOptional conf.d/*.conf

Save and close the apache2.conf file . Restart the apache2 service

sudo /etc/init.d/apache2 restart

(B) Edit Owncloud configuration file:
Edit the /etc/apache2/conf.d/owncloud.conf file.

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

Paste the below given contents.In this configuration we have configured SSL for owncloud and redirected all port 80 traffic to port 443 i.e HTTPS.

IMPORTANT NOTE : REPLACE 192.168.56.102 with your Server IP Address (use ifconfig command to find the ip address of server)

Optional Note: In case if you want both http and https running then remove all lines in between of line “#### Redirect to port 443 ###” and “#### End of Redirection configuration ###”



#### Redirect to port 443 ###
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
#### End of Redirection configuration ###

DocumentRoot /var/www/owncloud/

    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted






####Configuration for SSL #####
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/owncloud.pem
SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key
#### End of SSL Configuration ####

DocumentRoot /var/www/owncloud/

    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted


Save and close the file. Restart the apache2 service

sudo /etc/init.d/apache2 restart

Step C : Now Open the web browser and type ip address in URL address field.

For Example http://192.168.56.102 (Replace 192.168.56.102 with your server ip address)

https owncloud

https owncloud

https owncloud

NAME Based VirtualHost Apache configuration for https in Owncloud Server

To setup the name based virtual apache configuration,follow given below steps

(A) Edit apache2.conf file

Edit /etc/apache2/apache2.conf file.One parameter you have to modify and one parameter you have to add.

sudo vi /etc/apache2/apache2.conf

(i) Modify the value of “HostnameLookups Off” to “HostnameLookups On”

(ii) Add below given new line in apache2.conf file at the end of last line
IncludeOptional conf.d/*.conf

(B) Edit Owncloud configuration file.

Edit the Owncloud configuration file.In our system it is located in /etc/apache2/conf.d/owncloud.conf

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

Paste below given contents in /etc/apache2/conf.d/owncloud.conf file. Save and close the file after pasting
NOTE: Replace example.com with your Domain name


ServerName example.com
ServerAlias www.example.com

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


    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted





ServerName example.com
ServerAlias www.example.com

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

    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted



(C) Restart the apache2 service

sudo /etc/init.d/apache2 restart

(D) Open the web browser and type the domain name.

For example.

http://example.com

Replace example.com with your domain name in URL address field in web browser.

https owncloud

https owncloud part 2

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Setup self signed ssl certificate on Owncloud 6 in Ubuntu 14.04 LTS Server
  2. How to configure self signed SSL certificate in owncloud Ubuntu
  3. Setup self signed SSL certificate for ghost blog on Nginx
  4. Find date of expiry and issue of SSL certificate with command
  5. Create DV SSL Certificate and approve from CA authority
  6. Nagios Plugin : check ssl certificate expiry date
  7. Setup CRAM-MD5 authentication for mailing in owncloud Ubuntu
  8. How to install owncloud in Ubuntu 12.10
  9. Installing owncloud in Ubuntu 13.04
  10. htaccess file does not work : Owncloud 6 in Ubuntu 13.10 Server

Filed Under: Linux, owncloud, Server Tagged With: owncloud, Owncloud 6

Reader Interactions

Comments

  1. drizz says

    May 17, 2015 at 3:06 pm

    Hey,
    Great tutorial but I’ve hit a snag. I get this

    Syntax error on line 270 of /etc/apache2/apache2.conf:
    Invalid command ‘IncludeOptional’, perhaps misspelled or defined by a module not included in the server configuration
    Action ‘configtest’ failed.

    After trying to restart apache.

    Reply
    • sharad chhetri says

      May 19, 2015 at 4:38 pm

      Hi Drizz,

      Seems maybe some typo error . can you share the apache version you are using.

      Regards
      Sharad

      Reply
  2. Evgeniy Popov says

    July 21, 2014 at 8:18 am

    добрый день Шарад у меня вопрос как можно убрать пред просмотр видео при скачке файла

    Reply
    • sharadchhetri says

      July 21, 2014 at 10:41 am

      Translating into Emglish – “Good afternoon, I have a question Sharad how to remove short preview video in the jump file”

      Answer:
      Hello Evgeniy ,

      I did not understand your question. Can you give describe more or send screenshot to me

      Regards
      Sharad

      Translating to Russian ( using google translate )

      Здравствуйте Евгений,

      Я не понимаю ваш вопрос. Можете ли вы дать описать более или отправить скриншот мне

      С уважением
      Sharad

      Reply
  3. Anders says

    April 7, 2014 at 12:03 pm

    Why doesn’tsd you use /etc/apache2/site-avail and a2ensite?
    Those are the recommended ways to handle web sites for Apache in Debian/Ubuntu.

    Reply
  4. Eystein says

    March 28, 2014 at 10:35 am

    I found it, I’ve used a name instead of the IP adress of the server when i made the cert file. still have some issues with the apache server not finding the servername, but everything works in owncloud.

    Reply
    • sharad chhetri says

      March 28, 2014 at 12:59 pm

      In Ubuntu 13.10 , default is apache 2.4. Here for Server Name lookup by apache in VirtualHost configuration.
      Enable HostnameLookups in /etc/apache2/apache2.conf
      Change the value of “HostnameLookups Off” to “HostnameLookups On”

      Restart the apache2 service

      For further reading,have a look on this title “NAME Based VirtualHost Apache configuration for https in Owncloud Server ” in post.

      Reply
      • sharad chhetri says

        March 28, 2014 at 1:00 pm

        “apache server not finding the servername”
        Can you send me exactly the error you are getting ?

        Reply
  5. Eystein says

    March 27, 2014 at 3:30 pm

    Hi.

    after enabling ssl and https i’m getting this message in my Owncloud 6 settings:

    “Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken”

    Reply
    • sharad chhetri says

      March 27, 2014 at 4:15 pm

      Hello Eystein,
      This is a known issue in owncloud.For troubleshooting I need some answer.

      May I know have you done this setup from scratch ?
      Check the PHP version
      Regenerate the ssl certificate and check all steps once again.
      Can you send me the owncloud.log at admin@sharadchhetri.com

      Reply
      • Eystein says

        March 28, 2014 at 9:01 am

        Hello

        I’ve followed the steps in your OwnCloud 6 setup guide to the best of my ability 🙂
        I will try to regenerate, and if that dont work, I’ll send you the log.

        Reply
  6. Ralphael says

    March 20, 2014 at 12:41 am

    I followed your instructions to the “T” on setting up owncloud and this guide and now im getting page cannot be displayed with https and if i type http:// it gets redirected to https.. Before I did the owncloud https guide my site including owncloud (http) was working. What could I be missing? Thanks for you help in advance.

    Reply
    • sharad chhetri says

      March 20, 2014 at 2:35 pm

      Hello Ralphael,

      In Ubuntu 13.10 Server, by-default apache 2.4 is shipped.Which has some different parameter name.
      In configuration,I have redirected port 80 to 443 that is http to https.

      To work both http and https,
      Remove below given line

      #### Redirect to port 443 ###
      RewriteEngine on
      ReWriteCond %{SERVER_PORT} !^443$
      RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
      #### End of Redirection configuration ###
      
      Check in your system, where the owncloud files are located.
      The same path you have to mention in DocumentRoot section.
      
      I have given 2 types of VirtualHost Configuration,hence use only one.
      (1) Name Based Virtual Host
      (2) IP based Virtual Host
      

      Troubleshooting Steps :

      This document is created for Owncloud 6.x on Ubuntu 13.10 with Apache 2.4 version.

      (1) sudo apache2ctl -v ( The Apache version should be 2.4 or above)
      (2) cat /etc/issue (The Ubuntu version should be 13.10 )
      (3) sudo dpkg -l|grep owncloud (Owncloud package must be version 6 or more in version 6 series)
      (4) enable ssl and rewrite module (Here, I suspect ssl might not enabled)
      (5) Check the apache configuration of owncloud . Either it should be Name based or IP based
      The DocumentRoot should have exact path of owncloud files path for eg. /var/www/owncloud
      (6) There should be no duplicate owncloud apache configuration. For this check the files inside /etc/apache/sites-enabled and /etc/apache/conf.d

      (7) Recheck all the steps as per your Name based or IP based configuration

      IMPORTANT NOTE: Check the typo or spelling error.

      (8) If still has issue. Send below given information
      (a) What is the Ubuntu version you are using (sudo cat /etc/issue)
      (b) Owncloud apache configuration file
      (c) What is your requirement, IP based or Name based Virtual Host. If Name based then are you using any domain name.

      Reply
      • Ralphael says

        March 23, 2014 at 10:16 pm

        (a) What is the Ubuntu version you are using (sudo cat /etc/issue)
        Ubuntu 13.10 n l

        (b) Owncloud apache configuration file
        /etc/apache2/conf.d/owncloud.conf

        ServerName ralphaeljohnson.com
        ServerAlias http://www.ralphaeljohnson.com

        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted

        ServerName ralphaeljohnson.com
        ServerAlias http://www.ralphaeljohnson.com

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

        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted

        (c) What is your requirement, IP based or Name based Virtual Host. If Name based then are you using any domain name.
        Namebased… domain name is ralphaeljohnson.com

        thanks for your help.

        Reply
        • sharad chhetri says

          March 24, 2014 at 2:03 am

          Edit apache2.conf file

          sudo vi /etc/apache2/apache2.conf

          Find “HostnameLookups Off” and replace to “HostnameLookups On” in /etc/apache2/apache2.conf file

          Add line IncludeOptional conf.d/*.conf in /etc/apache2/apache2.conf file at end of file.

          Enable ssl sudo a2enmod ssl

          Restart apache2 service.

          sudo /etc/init.d/apache restart
          
          Reply
  7. Eli says

    March 9, 2014 at 5:40 pm

    I apologize if this question is not entirely appropriate for this post

    I recently installed owncloud on Ubuntu 12.04 (desktop 64 bit). The install process went smoothly and while I can access owncloud throughout my LAN with no problem, remote access is a no go.

    Is it possible that because I have not installed DNSMASQ that that is why I cannot access my server via onecloud outside of my network? I have enabled both ports 80 and 443 as well. Any Ideas? Also I am running owncloud via http not https (ssl) but I do not think that would affect my remote access.

    See here for the original link I used..https://www.digitalocean.com/community/articles/how-to-setup-owncloud-5-on-ubuntu-12-10

    Reply
    • sharad chhetri says

      March 9, 2014 at 7:36 pm

      Hello Eli,

      To access the owncloud publicly.Owncloud server must have public ip. or any public ip should be NAT with owncloud server

      Regards
      sharad

      Reply

Leave a Reply Cancel 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.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

Could not find make anywhere!!! Please edit the config section to include the path to make. at ./install.pl line 2101

How to find swap partition or file in linux

How to see system load average in terminal with graphical representation

Convert new line to space by using sed command

set and unset line number in file with vi editor

How to protect from port scanning and smurf attack in Linux Server by iptables

Password prompt in single user mode is not secure : CentOS/Red Hat

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ·
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy