Few days back I setup Owncloud 6 on Ubuntu 14.04 . After a gap of a few days, I again started the testing server to do some new practical. But after opening the Owncloud I got this given below error –

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

owncloud error

This was something new for me since I have been using Owncloud from its version 5. The error was describing itself, in which file we have to work.

Note:

The problem occured when I opened the owncloud link my testing domain name called example.com . As I know in starting at the time of installation, I did installation via web interface with IP Address of system.

Solution:

To solve this problem, we have to edit the config.php file of owncloud. In my case it is placed in /var/www/html/owncloud/config/config.php .

Step 1 : Edit the config.php with your favourite file editor. I prefer to go with vi editor

cd /var/www/html/owncloud/

vi  config/config.php

Step 2 : Find the line trusted_domains in config.php file. Now set new array with value 1 of your domain name or IP Address in config file. Please note, in array first array always have numeric number start with Zero ( i.e 0 )
Save and exit and restart the apache service

Below is my config.php file

root@ubuntu:/var/www/html/owncloud# cat config/config.php 
 'oc1190d4ed19',
  'passwordsalt' => '41e7078b980cda05aa546c0da37370',
  'trusted_domains' => 
  array (
    0 => '192.168.56.101',
    1 => 'example.com',
  ),
  'datadirectory' => '/var/www/html/owncloud/data',
  'dbtype' => 'mysql',
  'version' => '6.0.4.1',
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'ownclouduser',
  'dbpassword' => 'Password',
  'installed' => true,
);

Step 3: Restart the apache web server

In Debian/Ubuntu/Linux Mint

sudo service apache2 restart

In Red Hat/CentOS

service httpd restart

After this open the owncloud URL. I hope it works for you. Below given screenshot is from my system

Owncloud

Read Some More Articles

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.