Task 2 : Secure OwnCloud Web Traffic by Enabling HTTPS - KeegMitch/Operations-Engineering-group-c GitHub Wiki
Create the SSL key
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt
This command will prompt you for answers to these questions, this is what I filled out (Note: the common name should be your hostname)
Country Name (2 letter code) [XX]:NZ
State or Province Name (full name) []:.
Locality Name (eg, city) [Default City]:.
Organization Name (eg, company) [Default Company Ltd]:.
Organizational Unit Name (eg, section) []:.
Common Name (eg, your name or your server's hostname) []:app-c
Email Address []:.
In the /etc/apache2/sites-available/owncloud.conf
<VirtualHost *:443>
ServerName app-c
DirectoryIndex index.php index.html
DocumentRoot /var/www/owncloud
<Directory /var/www/owncloud>
Options +FollowSymlinks -Indexes
AllowOverride All
Require all granted
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/owncloud
SetEnv HTTP_HOME /var/www/owncloud
</Directory>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
</VirtualHost>
<VirtualHost *:80>
ServerName app-c
Redirect / https://13.75.139.57/
</VirtualHost>
Once the changes are made use these commands
sudo apachectl configtest
sudo systemctl restart apache2

Output:

