Vous êtes sur la page 1sur 15

sharadchhetri.

com
HOME

LINUX

BSD

CLOUDCOMPUTING

WORDPRESS

FREE E-BOOKS

ABOUT ME

You are here: Home / Linux / Setup Owncloud 6 with self signed SSL certificate on Ubuntu 13.10

Setup Owncloud 6 with self signed SSL


certificate on Ubuntu 13.10
March 9, 2014 by sharad chhetri 15 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 bydefault 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.

1 sudo apt-get install openssl

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

1 sudo a2enmod ssl


2 sudo a2enmod rewrite

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

1 sudo mkdir -p /etc/apache2/ssl

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

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

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.
D esc ription of our Server
Operating System : Ubuntu 13.10 Server edition
Arc h : x86_64
Apac he version : 2.4
Ownc loud Version : 6.0 (or 6.x)
Ownc loud D oc umetRoot path : /var/www/owncloud
Ownc loud c onfiguration File Path : /etc/apache2/conf.d/owncloud.conf
NOTE: We have written both IP based and Name based Virtual Host Apac he c onfiguration.
Use anyone method as per your requirement

IP Based VirtualHost Apache configuration for https


in Owncloud Server
(A) Edit apac he2.c onf file : Edit /etc/apache2/apache2.conf file.
And add the line Inc ludeOptional c onf.d/*.c onf at the end of file

1 sudo vi /etc/apache2/apache2.conf

1 ### paste below given lines,at the end of file apache2.conf ###3
2
3 IncludeOptional conf.d/*.conf

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

1 sudo /etc/init.d/apache2 restart

(B) Edit Ownc loud c onfiguration file:


Edit the /etc /apac he2/c onf.d/ownc loud.c onf file.

1 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 ifconfigcommand
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 ###

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

<VirtualHost 192.168.56.102:80>
#### 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/
<Directory /var/www/owncloud>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost 192.168.56.102:443>
####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/
<Directory /var/www/owncloud>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Save and close the file. Restart the apache2 service

1 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)

NAME Based VirtualHost Apache configuration for


https in Owncloud Server
To setup the name based virtual apache configuration,follow given below steps
(A) Edit apac he2.c onf file
Edit /etc/apache2/apache2.conf file.One parameter you have to modify and one parameter you have to
add.

1 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 Ownc loud c onfiguration file.
Edit the Owncloud configuration file.In our system it is located in
/etc /apac he2/c onf.d/ownc loud.c onf

1 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.c om with your D omain name

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
<Directory /var/www/owncloud>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:443>
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/
<Directory /var/www/owncloud>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

(C) Restart the apac he2 servic e

1 sudo /etc/init.d/apache2 restart

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

1 http://example.com

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

Would like to share !?

Related Posts:
1. Setup self signed ssl c ertific ate on Ownc loud 6 in Ubuntu 14.04 LTS Server
2. How to c onfigure self signed SSL c ertific ate in ownc loud Ubuntu
3. htac c ess file does not work : Ownc loud 6 in Ubuntu 13.10 Server
4. How to install Ownc loud 6 on Ubuntu 14.04 LTS Server

5. Your data direc tory and files are probably ac c essible from the internet bec ause the
.htac c ess file does not work ownc loud
6. Installing ownc loud in Ubuntu 13.04
7. How to install Ownc loud 6 in Ubuntu 13.10 Server
8. Setup CRAM-MD 5 authentic ation for mailing in ownc loud Ubuntu
Filed Under: Linux, owncloud, Server
Tagged With: owncloud, Owncloud 6

TAGS
Amazon AWS

apache awk bash script cat CentOS centos 7 debian freebsd ftp git Git Server grep hostname

iptables linux

linux command linux

nginx

commands linuxmint Linux Mint logging mysql Nagios

Octopress owncloud Owncloud 6 php postfix python rpm runlevel sed squid ssh swap

ubuntu user management

15 Comments

varnish vim

virtualbox vsftp vshell

wordpress yum

sharadchhetri.com

Sort by Best

Login

Share

Favorite

Join the discussion


Evgeniy Popov

a month ago


Reply Share

sharadchhetri

Mod

Evgeniy Popov a month ago

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

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 Share

Anders

5 months ago

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 Share

Eystein

5 months ago

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 Share

sharad chhetri

Eystein 5 months ago

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 Share

sharad chhetri

sharad chhetri 5 months ago

"apache server not finding the servername"


Can you send me exactly the error you are getting ?
Reply Share

Eystein

5 months ago

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 Share

sharad chhetri

Eystein 5 months ago

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 ?

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 Share

Eystein

sharad chhetri 5 months ago

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 Share

Ralphael

5 months ago

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 Share

sharad chhetri

Ralphael 5 months ago

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.
see more
Reply Share

Ralphael

sharad chhetri 5 months ago

(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 www.ralphaeljohnson.com
Options Indexes FollowSymLinks MultiViews

Options Indexes FollowSymLinks MultiViews


AllowOverride All
Require all granted
ServerName ralphaeljohnson.com
ServerAlias www.ralphaeljohnson.com
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/owncloud.pem
SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key
DocumentRoot /var/www/owncloud/
see more

Reply Share

sharad chhetri

Ralphael 5 months ago

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/*.confin /etc/apache2/apache2.conf file at end of
file.
Enable ssl sudo a2enmod ssl
Restart apache2 service.
sudo /etc/init.d/apache restart
Reply Share

Eli

6 months ago

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...
Reply Share

sharad chhetri

Eli 6 months ago

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 Share

ALSO ON SHARADCHHETRI.COM

WHAT'S THIS?

WHAT'S THIS?

ALSO ON SHARADCHHETRI.COM

There are unfinished transactions remaining.


You might consider running

Taking file backup while using sed command


with -i flag

2 comments 24 days ago

2 comments a month ago

sharadchhetri Awesome Thanks David for giving

sharadchhetri Thankyou Tatsh,Very well said.

feedback.It will help new CentOS 7 usersThanks


and RegardsSharad

You really made a good point.Thanks for


highlightingRegardsSharad

How to configure vsftpd server with virtual user


mysql authentication in CentOS 6
1 comment 2 months ago

Jared Sharad,Thanks for this post; it has pointed

me in the right direction. I do have a few questions


for you:1. How would one configure

Subscribe

How to install XAMPP on CentOS/RHEL 6.5


1 comment 2 months ago

DrEng There might be a typo in step 2. Had to

point to root first before accessing the xamp


installer with the '/'chmod +x

Add Disqus to your site

Search the site ...

FOLLOW US TO GET LATEST UPDATES

Subscribe to get latest tutorial updates in


your e-mail from sharadchhetri.com
email address

SUBSCRIBE

Encontre-nos no Facebook

sharadchhetri.com
Curtir
385 pessoas curtiram sharadchhetri.com.

Plug-in social do Facebook

RELATED AWESOME 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. htaccess file does not work : Owncloud 6 in
Ubuntu 13.10 Server
4. How to install Owncloud 6 on Ubuntu 14.04 LTS
Server
5. Your data directory and files are probably
accessible from the internet because the
.htaccess file does not work owncloud
6. Installing owncloud in Ubuntu 13.04
7. How to install Owncloud 6 in Ubuntu 13.10
Server
8. Setup CRAM-MD5 authentication for mailing in
owncloud Ubuntu

RECENT POSTS
How to install Nagios 4 from source on Ubuntu
14.04 LTS

error: The requested URL returned error: 403


Forbidden while accessing Github repo
FAQ on CentOS 7 / RHEL 7 : Alternate of ifconfig
command
How to print particular line number by using sed
command
There are unfinished transactions remaining. You
might consider running yum-complete-transaction
Install MariaDB Server on CentOS 7 / RHEL 7
How to install MySQL Server 5.6 on CentOS 7 /
RHEL 7
Install pagespeed module ( mod_pagespeed ) on
Apache Web Server : CentOS / RHEL
How to install nginx from source on CentOS 7
Cant load
/usr/local/lib64/perl5/auto/nginx/nginx.so

RECENT COMMENTS
sharadchhetri on create noreply email id in postfixadmin
mysql database
alex on create noreply email id in postfixadmin mysql
database
sharadchhetri on How to install Owncloud 6 on Ubuntu
14.04 LTS Server
sharadchhetri on Install and configure nagios core 4 on
Ubuntu 12.04 LTS
Rene Munsch on Install and configure nagios core 4 on
Ubuntu 12.04 LTS

SERVERS/TOPICS

Select Category

ARCHIVES

Select Month

Copyright 2009 - 2014 All Rights Reserved sharadchhetri.com Privacy Policy StudioPress Themes for
WordPress
sharadchhetri.com Domain is Registered with GoDaddy The content is copyrighted to sharadchhetri.com and
may not be reproduced on other websites without our permission.

Vous aimerez peut-être aussi