60.1 Nextcloud Install


We will set up our illustrative nextcloud server on the imaginary example.com, with a reverse proxy for cloud.example.com. This cloud.example.com domain could alternatively be a dedicated server with an external reference (A record) set up through your DNS provider, using the IP address of the server. If you have only an IP address and no domain name for your server have a look at Section 59.18 to access your server remotely by the IP address.

Connect to the server and prepare it for running nextcloud:

ssh kayon@example.com

Install nextcloud as a snap package:

sudo snap install nextcloud

The Nextcloud configuration is contained in /var/snap/nextcloud/current/nextcloud/config/config.php and we will come back to editing this file shortly, if needed.

Configure a user as the administrator of the nextcloud server, using the command line. This will also avoid a small risk with using the web-based mechanism to set this up whereby someone could visit the web site before you have set up the user.

sudo nextcloud.manual-install kayon <password>

For a reverse proxy setup using Caddy (see Section 94.3), we’ll set the Nextcloud server to listen to port 81:

sudo snap set nextcloud ports.http=81

The caddy configuration file /etc/caddy/Caddyfile should then have the following appended to it so that anything sent to cloud.example.com is redirected to the localhost’s port 81. The Strict-Transport-Security setting is suggested by the security & setup warnings message: The “Strict-Transport-Security” HTTP header is not set to at least “15552000” seconds.

cloud.example.com {
    rewrite /.well-known/carddav /remote.php/dav
    rewrite /.well-known/caldav /remote.php/dav

    reverse_proxy localhost:81

    header {
        Strict-Transport-Security max-age=15552000;

After making this update reload the configuration into the caddy server:

systemctl reload caddy

Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0