Server Setup 9: Nextcloud Prep

If this is your first time looking at a post from this series, have a look at this summary: Server Setup 0: Contents

First, we need 1 extra PHP module:

sudo apt install php-gd

Like with WordPress, we’ll create a folder and apache configuration for Nextcloud:

cd /var/www
sudo mkdir nextcloud
sudoedit /etc/apache2/sites-available/nextcloud.conf

And we’ll use essentially the same apache configuration we used for wordpress, with a few tweaks.

<VirtualHost *:80>
    ServerName nextcloud.example.org
    DocumentRoot /var/www/nextcloud
    
    <Directory /var/www/nextcloud/>
        Require all granted
        AllowOverride All
        Options FollowSymLinks MultiViews

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

    ErrorLog ${APACHE_LOG_DIR}/nextcloud_error.log
    CustomLog ${APACHE_LOG_DIR}/nextcloud_access.log combined
</VirtualHost>

We’ll also create a temporary configuration for collabora while we’re here:

sudoedit /etc/apache2/sites-available/collabora.conf
<VirtualHost *:80>
    ServerName collabora.example.org
    ErrorLog ${APACHE_LOG_DIR}/collabora_error.log
    CustomLog ${APACHE_LOG_DIR}/collabora_access.log combined
</VirtualHost>

This is just a barebones template that’s just enough to let us set up HTTPS later.

Enable the sites and reload apache:

sudo a2ensite nextcloud collabora
sudo systemctl reload apache2

DNS

We need to create DNS Entries for Nextcloud and Collabora:

  1. Log into the control panel for your domain.
  2. Create a CNAME record
    • Domain: e.g. nextcloud.example.org
    • Data: e.g. example.org if you had a fixed IP, or the dynamic DNS server address you created e.g. anotherexample.ddns.net
  3. Do the exact same for collabora.example.org

HTTPS

Use certbot again to enable https on both nextcloud.example.org and collabora.example.org

sudo certbot --apache

When it asks you which sites you want to activate HTTPS for, you can select multiple options by putting a comma separated list. You can also choose to allow certbot to automatically reconfigure apache to Redirect (option 2 when it asks you).

Leave a Reply

Your email address will not be published.