Configuring SSL connections for Owncloud
Before you start using owncloud, it is strongly recommended that you enable SSL support in Owncloud. Using SSL can provide important security benefits, such as encrypting owncloud traffic and providing appropriate authentication. In this tutorial, you will use a self-signed certificate for SSL.
Create a directory to store the server keys and certificates:
# mkdir /etc/apache2/ssl
Create a certificate (and have a key to protect it), which has a one-year validity period.
Edit/etc/apache2/conf.d/owncloud.conf Enable HTTPS. For the meaning of NC, R, and L in rewrite rules, you can refer to the Apache documentation:
Alias /owncloud /var/www/owncloud<VirtualHost 192.168.0.15:80> RewriteEngine on ReWriteCond %{SERVER_PORT} !^443$ RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]</VirtualHost><VirtualHost 192.168.0.15:443> SSLEngine on SSLCertificateFile /etc/apache2/ssl/apache.crt SSLCertificateKeyFile /etc/apache2/ssl/apache.key DocumentRoot /var/www/owncloud/<Directory /var/www/owncloud> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny Allow from all</Directory></VirtualHost>
To enable the rewrite module and restart Apache:
Open your owncloud instance. Note that even if you try to use HTTP, you will automatically be redirected to HTTPS.
Note that even if you have followed the steps above, when you start owncloud you will still see an error message stating that the certificate has not been issued by a trusted institution (that is because we created a self-signed certificate). You can safely ignore this message, but if you consider deploying owncloud on a production server, you can purchase a certificate from a trustworthy company.
https://github.com/LCTT/TranslateProject/blob/master/published/201411/20140901%20How%20to%20install%20and% 20configure%20owncloud%20on%20debian.md
Configuring SSL connections for Owncloud