How to Give Your Nextcloud a Custom Domain Name

Introduction

Nextcloud is a versatile and powerful open-source platform that allows you to set up your own cloud server for file storage, collaboration, and more. To make your Nextcloud installation more accessible and user-friendly, you can assign a custom domain name to it. This not only provides a professional touch but also simplifies access for you and your users. In this guide, we will walk you through the process of giving your Nextcloud instance a custom domain name.

Prerequisites

Before you start, make sure you have the following prerequisites in place:

  1. Nextcloud Installed: You should already have Nextcloud up and running on your server.
  2. A Registered Domain: You need a domain name that you’ve registered through a domain registrar. This domain will be used to access your Nextcloud instance.

Step 1: Obtain a Static IP Address for Your Server

Begin by opening a terminal window on your Ubuntu Server. The terminal is your gateway to the command line, where you can interact with your server’s operating system.

Once your terminal is up and running, simply type the following command and press ‘Enter’:

ifconfig

Step 2: Configure DNS Settings

  1. Log in to your domain registrar’s control panel.
  2. Locate the DNS settings or Domain Management section.
  3. Create a new DNS record (often referred to as an “A Record”) with the following details:
    • Type: A
    • Host or Name: Enter ‘@’ to represent your root domain.
    • IP Address: Enter your server’s static IP address.
    This record will associate your domain with your server’s IP address.
  4. Create a CNAME record to point the ‘www’ subdomain to your domain. The details for the CNAME record are:
    • Type: CNAME
    • Host or Name: Enter ‘www’
    • Value: Enter your domain name.
    This step ensures that both ‘yourdomain.com’ and ‘www.yourdomain.com‘ direct users to your Nextcloud.
  5. Save your DNS settings.

Example) AWS Route 53

A record example
CNAME record example

Even if you complete adding records, you will encounter this message. In order to access your nextcloud, you also need to add the domain in the configuration file.


Run the following command to set a trusted domain for Nextcloud, replacing yourDomainName with your actual custom domain:

sudo nextcloud.occ config:system:set trusted_domains 1 --value=yourDomainName

sudo nextcloud.occ config:system:set trusted_domains 2 --value=yourDomainName2

By executing these commands, you will have two trusted domains configured for your Nextcloud instance, allowing access from both yourDomainName1 (A record) and yourDomainName2(CNAME record).

Leave a Reply

Your email address will not be published. Required fields are marked *