Nextcloud trusted domainNextcloud is a powerful and flexible cloud platform that allows you to store, sync, and share your files, contacts, calendars, and more. However, sometimes you may encounter an issue when you try to access your Nextcloud instance from a different domain name or IP address than the one you initially configured. You may see an error message like this:

You are accessing the server from an untrusted domain. Please contact your administrator. If you are an administrator of this instance, configure the “trusted_domains” setting in config/config.php. An example configuration is provided in config/config.sample.php or at the documentation.

This error is caused by a security feature of Nextcloud called trusted domains. Trusted domains are used by Nextcloud to prevent Host Header Poisoning, a type of attack that exploits the HTTP Host header value to perform malicious actions. To avoid this, Nextcloud requires you to specify every domain name or IP address that you want to use to access your Nextcloud instance. This way, Nextcloud can verify that the request is coming from a legitimate source.

In this article, we will show you how to add a new trusted domain to your Nextcloud configuration, using either SSH or cPanel. We will also explain how you can avoid this problem altogether by using a reliable hosting service like Cloudamo, which offers free support and automatic configuration for Nextcloud.

Adding a New Trusted Domain via SSH

If you have SSH access to your server hosting Nextcloud, you can edit the configuration file directly using a command-line text editor. Here are the steps to follow:

  1. Log into your server using SSH. You can use a tool like PuTTY or Terminal to connect to your server.
  2. Navigate to the directory where your Nextcloud installation is located. For example, if you installed Nextcloud in the /var/www/html/nextcloud directory, you can use the command cd /var/www/html/nextcloud.
  3. Open the configuration file with the command sudo nano config/config.php. You may need to enter your password to proceed.
  4. In the editor, locate the trusted_domains section and add a new item to the array with the new domain name or IP address as the value. For example, if you want to add cloud.example.com as a trusted domain, you can add the line '1' => 'cloud.example.com', below the existing line '0' => '192.168.0.29',. The final result should look something like this:
'trusted_domains' => 
  array (
    '0' => '192.168.0.29',
    '1' => 'cloud.example.com',
  ),
  1. Save and close the file by pressing Ctrl+X, then Y, then Enter.
  2. You should now be able to access your Nextcloud instance from the new domain name or IP address without any error.

Adding a New Trusted Domain via cPanel

If you do not have SSH access to your server, but you have cPanel access, you can use the File Manager tool to edit the configuration file. Here are the steps to follow:

  1. Log into your cPanel account and go to File Manager.
  2. Navigate to the public_html directory and find the config.php file of your Nextcloud installation. Right-click on the file and select Edit.
  3. In the editor, locate the trusted_domains section and add a new item to the array with the new domain name or IP address as the value. For example, if you want to add cloud.example.com as a trusted domain, you can add the line '1' => 'cloud.example.com', below the existing line '0' => '192.168.0.29',. The final result should look something like this:
'trusted_domains' => 
  array (
    '0' => '192.168.0.29',
    '1' => 'cloud.example.com',
  ),
  1. Save and close the file by clicking on Save Changes.
  2. You should now be able to access your Nextcloud instance from the new domain name or IP address without any error.

How to Avoid Trusted Domain Issues with Cloudamo

As you can see, adding a new trusted domain to Nextcloud is not very difficult, but it can be tedious and error-prone if you have to do it frequently or for multiple domains. Moreover, if you use a dynamic IP address, you may have to update the configuration file every time your IP changes.

Fortunately, there is a better way to avoid these issues: using a reliable hosting service like Cloudamo. Cloudamo is a specialized hosting provider for Nextcloud, offering fast, secure, and affordable plans for personal and business use. With Cloudamo, you can enjoy the following benefits:

  • Free support: Cloudamo offers free and friendly support for any issues or questions you may have regarding Nextcloud. You can contact them via email, chat, or phone, and they will respond quickly and professionally.
  • Automatic configuration: Cloudamo takes care of all the technical aspects of setting up and maintaining your Nextcloud instance. You do not have to worry about installing, updating, or configuring Nextcloud, as Cloudamo does it for you automatically. You also do not have to deal with trusted domains, as Cloudamo handles them for you as well.
  • Custom domain name: Cloudamo allows you to use your own domain name for your Nextcloud instance, without any extra cost or hassle. You can choose any domain name you want, and Cloudamo will set it up for you in minutes. You can also use a subdomain, such as cloud.yourdomain.com, if you prefer.
  • SSL certificate: Cloudamo provides a free SSL certificate for your Nextcloud instance, ensuring that your data is encrypted and secure. You do not have to purchase or install a certificate yourself, as Cloudamo does it for you automatically.
  • Backup and restore: Cloudamo offers a backup and restore feature for your Nextcloud instance, allowing you to recover your data in case of any disaster. You can choose the frequency and retention of your backups, and restore them with a few clicks if needed.

If you are looking for a hassle-free and cost-effective way to host your Nextcloud instance, Cloudamo is the best choice for you. You can sign up for a free trial and see for yourself how easy and convenient it is to use Cloudamo. You can also check out our plans and pricing, and choose the one that suits your needs and budget.

 


Wednesday, February 14, 2024

« Back