2017-11-03: This is not needed if you are using any of our  VMs as the Let’s Encrypt script handles the conf file generation.

BECOME ROOT in UBUNTU
:~$ sudo -i
ACTIVATE SSL
:~$ a2enmod ssl
:~$ a2enmod headers
:~$ service apache2 restart
MAKE A NEW CONF FILE
:~$ nano /etc/apache2/sites-available/example_owncloud.conf
PUT THIS IN THE FILE YOU JUST MADE
<VirtualHost *:443>
    Header add Strict-Transport-Security: "max-age=15768000;includeSubdomains"
    SSLEngine on

### YOUR SERVER ADDRESS ###
     ServerAdmin [email protected]
     ServerName example.com
     ServerAlias subdomain.example.com 

### SETTINGS ###
    DocumentRoot /var/www/owncloud

    <Directory /var/www/owncloud>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
    Satisfy Any 
    </Directory>

    Alias /owncloud "/var/www/owncloud/"

    <IfModule mod_dav.c>
    Dav off
    </IfModule>

    SetEnv HOME /var/www/owncloud
    SetEnv HTTP_HOME /var/www/owncloud

### LOCATION OF CERT FILES ###
    SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
</VirtualHost>
AFTER YOU HAVE MADE THIS YOU NEED TO ENTER THE DOMAIN INTO
~:$ nano /etc/hosts
IT SHOULD LOOK SOMETHING LIKE THIS:
127.0.0.1 localhost.localdomain localhost owncloud
127.0.1.1 owncloud

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback 
ff02::1 ip6-allnodes 
ff02::2 ip6-allrouters
ACTIVATE YOUR NEW CONFIG
:~$ a2ensite example__ddns_net.conf
:~$ sudo service apache2 reload
DEACTIVATE YOUR DEFAULT-SSL CONFIG
~$ a2dissite default-ssl.conf
:~$ sudo service apache2 reload

That’s all!


 

 PRO TIP

Secure your ownCloud against brute-force attempts. Configure Fail2ban!