Enable https local instance

Hi all,

So i’m running a local instance of nextcloud and i’m trying to get it to use https with the following:

<VirtualHost *:80>

ServerAdmin admin@example.com

DocumentRoot "/var/www/html/nextcloud"

ServerName 192.168.1.152

Redirect permanent / https://192.168.1.152/

<Directory "/var/www/html/nextcloud/">

Options MultiViews FollowSymlinks

AllowOverride All

Order allow,deny

Allow from all

</Directory>

TransferLog /var/log/apache2/nextcloud_access.log

ErrorLog /var/log/apache2/nextcloud_error.log

</VirtualHost>

<VirtualHost *:443>

ServerAdmin admin@example.com

DocumentRoot "/var/www/html/nextcloud"

ServerName 192.168.1.152

<Directory “/var/www/html/nextcloud/”>

Options MultiViews FollowSymlinks

AllowOverride All

Order allow,deny

Allow from all

</Directory>

TransferLog /var/log/apache2/nextcloud_accesshttps.log

ErrorLog /var/log/apache2/nextcloud_errorhttps.log

</VirtualHost>

but i can’t get the page to load after restarting apache. I’m not looking to get it ssl signed just yet.

i’m sure my config is bad any help would be great

Solved -

"It is very important to tell the server to listen on port 443. That’s why you need to add a line to ports.conf (/etc/apache2/ports.conf) file. After the modification your file should look something like this:

Listen 443
Listen 80"

I think to work as https site you need SSL certificates. There seems to be a workaround with
Listen *:443 http
in ports.conf. In this case, the site will work with normal http on port 443, if that is what you want.
Setting up LetsEncrypt certificates is not rocket science.