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.
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
TIAGO PALUDP says
This doesnt works for me.
Fannie Murnin says
Top IOS Apk free download page. Look at expert criticals about Android Premium
Mods.
Bernd Kiefer says
I just installed owncloud 10 and followed your (and many others) directions to set up the trusted domains. What only worked for me is to add the full server names, not just the domain. If i added just the domain, the same error popped up.
Thomas says
Thanks… Worked like a charm 🙂
Sylvainrp says
bonjour tout le monde
j ai un gros problème ça vas faire trois jours que je bûche dessus.j ai un serveur freenas ou
j ai installer via le plugin owncloud .
Et IMPOSSIBLE de mettre la main sur le fichier config.conf mĂŞme quand je vais la
cd usr/local/www/owncloud/config/
rien y a juste le fichier config.sample.php et .htaccess
je ne comprend pas pourtant mon owncloud en local marche très bien
Quel qu’un a une idĂ©e?
et c est owncloud 9.0 si ca peux vous aider
Sylvainrp says
Je me suis trompé c est config.php voila
en espérant que qu un trouve une solution .
Sharad Chhetri says
Bonjour Sylvainrp,
je vous remercie de rétroaction
Regards
Sharad
Sharad Chhetri says
Translated version (Credit: Google Translate)
Hello everybody
I have a big problem going to do it three days I ‘ve dessus.j log server or a freenas
I have installed via owncloud plugin.
And IMPOSSIBLE to get hold of the file even when I go the config.conf
cd usr / local / www / owncloud / config /
nothing is just the .htaccess file and config.sample.php
I do not yet understand my owncloud locally works fine
What one has an idea ?
and c is 9.0 owncloud ca if you can help
skynet says
no need to restart apache because you changed a php file
pedro says
for those who want to disable the thrusted domain option from own cloud , and want to allow any domain , then make this change in config.php
‘log_type’ => ‘owncloud’,
‘datadirectory’ => ‘/media/xxx-xxxx–xxx–xxxxx–xxx/data/’, true,
);
then save the config.php
and then restart nginx or apache2 server depending on witch server your own cloud is working .
Debian 8
/etc/init.d/nginx restart
for apache :
/etc/init.d/apache2 restart
Nikita says
as for me better solution is to add following code to /lib/private/security/trusteddomainhelper.php
foreach($trustedList as $trustedDomain){
if( $trustedDomain[0] == ‘*’
&& strpos(strrev($domain), substr(strrev($trustedDomain), 0, -1)) === 0){
return true;
}
}
after that you will be able to specify domain list by the template *.mydomain.com
John says
So many post out there about how to address this issue however, most fail to address where the installation defaults to. Though my installation is a little different than is shown here, I was able to work it out due to this most brilliant post, well formatted and you unlike most have addressed where the config.php file lives, I can’t thank you enough, Brilliant work from a seasoned professional. I, like you, spend much time helping others, it’s refreshing to see such good work Sharad.
Now that I’ve blown some smoke up your A– lol do you think you might help me out?
I just installed owncloud in a (paravirtualized Ubuntu LTS minimal install) VM under XenServer, it’s connection IP is a WAN routable IP and I’ll be using host based security once it’s all set up properly.
The setup installed without errors and I logged in from the WAN IP
Ex: http://126.124.148.25/owncloud/
I have configured a sub domain and pointed it to the WAN IP and applied the fix (trusted_domains) below
So now I can login from
Ex: http://cloud.mydomain.net/owncloud/ nice however…
My question is – how can I gain access with a trusted domain like you have in this tute
http://cloud.mydomain.net/
config.php below edited to protect the innocent
$CONFIG = array (
‘instanceid’ => ‘oc8d8fe7cb54’,
‘passwordsalt’ => ‘blar blar lol’,
‘secret’ => ‘blar blar lol’
‘trusted_domains’ =>
array (
0 => ‘cloud.mydomain.net’,
1 => ‘www.cloud.mydomain.net’,
),
‘datadirectory’ => ‘/var/www/owncloud/data’,
// ‘overwrite.cli.url’ => ‘http://124.148.146.146/’, I commented this out but no joy ether way
Thanks in advance Sharad & I understand if you busy.
BTW, nice site.
Best Regards
– JH
sharad chhetri says
Thanks John,
Yeah, now a days got very busy.Now back to your question, I think below one is core question
As per your requirement, setup “Name based Virtual Hosting” in apache.
You can read this post , https://sharadchhetri.com/2014/05/22/install-owncloud-6-ubuntu-14-04-lts-server/ .
Go to “Name based Virtual Hosting” section. I hope it will work for you.
Regards
Sharad
John says
Thanks Sharad,
I can not find owncloud.conf in /etc/apache2/sites-enabled/owncloud.conf
I only have 000-default?
I tried creating owncloud.conf with the suggested config in etc/apache2/sites-enabled/ but I get just what I thought I would get “apache error” lol
It’s a bit annoying it sets up like this by default and there is a lack of information about this type of configuration.
John says
HI Sharad,
I followed your post https://sharadchhetri.com/2014/05/22/install-owncloud-6-ubuntu-14-04-lts-server/ .
I had some issues getting it working, I needed to change…
cd nano /etc/apache2/sites-enabled/owncloud.conf
to ex: below
————————————————————————————————-
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/
ServerName my.subdomain.net
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
—————————————————————————————————
And then adjust the config.php…
cd /var/www/html/config/config.php
and append two lines
‘datadirectory’ => ‘/var/www/owncloud/data’, to ‘datadirectory’ => ‘/var/www/html/data’,
‘overwrite.cli.url’ => ‘192.168.0.1/owndloud’, to overwrite.cli.url’ => ‘http://my.subomain.net/html’,
—————————————————————————————————
‘oc8d8fe7cb54’,
‘passwordsalt’ => ‘ea8ebbdc785fd15be0334f4d3ed70a’,
‘secret’ => ‘fa11560cb61b5c5d2bfe8fc7f2297f79286d27da13c238e19692a14fb3175d0f$
‘trusted_domains’ =>
array (
0 => ‘124.148.136.196’,
0 => ‘my.subdomain.net’,
),
‘datadirectory’ => ‘/var/www/html/data’,
‘overwrite.cli.url’ => ‘http://my.subomain.net/html’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘7.0.4.2’,
‘dbname’ => ‘struth’,
‘dbhost’ => ‘localhost’,
‘dbtableprefix’ => ‘oc_’,
—————————————————————————————————
Now it works from my sub.domain.net
WooHoo
Best regards
– John Hartney
PS) if you would like to use this on any page or edit lines – be my guest – and thanks again Sharad.
sharad chhetri says
Thankyou John,
Feedback is very important. With different cases we face different issue. Your valuable feedback will be helpful to many readers.
In short word, Awesome !! Highly Appreciate.
Regards
Sharad