How to Setup NextCloud with TurnKey Linux

Open the proxmox manager (DNS should look like https://VirtMan-XX.yourdomainspace.com:8006). Login with a DomainAdmins account.

Install a fresh TurnKey Linux NextCloud Stack using one of the available template in proxmox.
See How to Setup a TurnKey Linux Container

Now that you have a NextCloud Stack running, you will need to connect to it using the 'root' account.

ssh root@cloud.yourdomainspace.com

Once connected, you will be ask to create the mysql 'root' password and the NextCloud 'admin' password. Before we go in the NextCloud interface, we also have to make sure the web server has the appropriate ACL(s) for the NextCloud installation to perform app installed and update the server.

chown -vR www-data:www-data /usr/share/nextcloud/

You can now connect to your NextCloud server from your browser.

https://cloud.yourdomainspace.com

I recommend you enforce SSL encryption on the site. You can achieve this by opening the 000-default.conf file.

nano /etc/apache2/sites-available/000-default.conf

And add a redirect directive to the VirtualHost *:80.

Redirect / https://cloud.yourdomainspace.com/

Once you are done editing the config file. You will need to restart the apache service to apply the changes.

service apache2 restart

You can use Let's Encrypt to provide the SSL Certificate for your NextCloud installation. TurnKey Linux already provides a simple interface to make those changes to you Stack. You can enter :

confconsole

From there, you can go into the <Advanced Menu> and select “Let's encrypt”.

Once there, we first need to generate a certificate by selecting “Get certificate”. You will get a tips explaining that to create the certificate, a valid DNS record must exist on the web. If this is not the case, make sure you configure one. If this site is only displayed in the internal network, just configure a dummy web server and create a DNS record that points to it online. This will allow CertBot to find something in order to confirm that the certificate you are requesting points to a site that exist. Now you can enter all the valid DNS Record that points to the NextCloud site.

Now that you have your certificate, you should enable the automatic renewal of the certificate.

Let's Encrypt is now configured.