and both URLs would point to the same NC-instance? is this what you want to achieve? just a change of the theming but everything else would be the same?
your solution looks perfect for me. I Like to do the same but get some Errors.
Could you give me some more Information? How looks your config.php ? Did you add something else there?
# if not set in config/config.php
$CONFIG['trusted_domains'] = array (
0 => 'cloud.domain1.com',
1 => 'cloud.domain2.com',
2 => 'cloud.domain3.com',
3 => 'cloud.domain4.com',
);
if (isset($_SERVER['HTTP_HOST'])) {
switch ($_SERVER['HTTP_HOST']) {
# Server called with cloud.domain1.com
case 'cloud.domain1.com':
# sure, we can do more stuff like checking an existing
# directory in the themes directory
# use this theme (must exists in themes/ )
$CONFIG['theme']='cloud.domain1.com';
# configure local-part of email address
$CONFIG['mail_from_address'] = 'no-reply';
# configure domain of email address
$CONFIG['mail_domain'] = 'domain1.com';
break;
case 'cloud.domain2.com':
$CONFIG['theme']='cloud.domain2.com';
$CONFIG['mail_from_address'] = 'no-reply';
$CONFIG['mail_domain'] = 'domain2.com';
break;
# and so on for other domains
}
}
The directory “themes/domain1.com” contains the following files:
themes/domain1.com/defaults.php
themes/domain1.com/core/apps/img/favicon-touch.png
themes/domain1.com/core/css/server.css
themes/domain1.com/core/img/favicon.ico
themes/domain1.com/core/img/logo.svg
themes/domain1.com/core/img/domain1.com-norm.svg
themes/domain1.com/core/img/favicon-touch.png
themes/domain1.com/core/img/domain1.com-logo.svg
themes/domain1.com/core/img/favicon-64.png
themes/domain1.com/core/img/favicon-16.png
themes/domain1.com/core/img/domain1.com-logo-wide.svg
themes/domain1.com/core/img/favicon-128.png
themes/domain1.com/core/img/favicon-256.png
themes/domain1.com/core/img/favicon-32.png
themes/domain1.com/core/img/favicon.png
themes/domain1.com/defaults.php:
<?php
class OC_Theme {
# for a list of functions see /lib/private/defaults.php
function __construct() {
}
public function getTitle() {
return "My Own Nextcloud";
}
public function getName() {
return "Best-Cloud";
}
public function getHTMLName() {
return "Best-Cloud";
}
public function getEntity() {
// Footer-Name
return "My Company";
}
public function getSlogan() {
return "We do everything for you :-)";
}
public function getLongFooter() {
return $this->getShortFooter();
}
public function getShortFooter() {
return '<a href="https://domain1.com" target="_blank" rel="noreferrer">' . $this->getEntity() . '</a> - ' . $this->getSlogan();
}
public function getLogoClaim() {
return '';
}
This works also for different email settings for each domain:
# cat domains.config.php
<?php
if (isset($_SERVER['HTTP_HOST'])) {
switch ($_SERVER['HTTP_HOST']) {
# Server called with cloud.domain1.com
case 'domain1.de':
$CONFIG['mail_from_address'] = '*****';
$CONFIG['mail_domain'] = 'domain1.de';
$CONFIG['mail_smtpname'] = '******';
$CONFIG['mail_smtppassword'] = '******';
break;
case 'domain2.de':
$CONFIG['mail_from_address'] = '*****';
$CONFIG['mail_domain'] = 'domain2.de';
$CONFIG['mail_smtpname'] = '******';
$CONFIG['mail_smtppassword'] = '******';
break;
# and so on for other domains
}
}
your example helped me a lot, when trying to achieve something similar.
I was able to successfully change colors and texts, but up to now, I was unable to set different logos or favicons, the nextcloud default svg is always the logo instead.
In fact, none of those files in the img folder is ever used.
Which $CONFIG element is the WALLPAPER / background image? Can’t find in config.php, and also can’t find any picture in folder structure. Stored in database?
Am I right that you don’t need to define ALL $CONFIG elements for each domain in trusted_domains? If some are undefined, do they stay on the default / inherit their default value? Or do I have to define a complete $CONFIG set, even if I only want to change the wallpaper and all other should be nextcloud’s defaults?
Some notes/mistakes I made that may help other people.
In ‘domains.config.php’, don’t forget to add <?php to the top. The post above that I was following from didn’t have it so the config was output as plain text.
You need to disable the app Theming. It will override the manual theme you’ve made.
The defaults.php from the thread didn’t work for me, maybe something changed since the posts or some hidden characters buggered it up in copying? I copied the example one in: /themes/example/defaults.php
Made edits to that and everything was fine.
I also copied the example css to my new themes and tweaked away: /themes/example/core/css/server.css
I’m noticing a problem with the per domain theming when it comes to the system emails. It does’t use the theme logo and the email template places the default NC logo for all the domains.
All the other text defined edits are correct in the emails. The logo even displays the correct alt text from getName() from the theme’s default.php. It is just the image it pulls is the core logo: domain.com/core/img/logo=/logo.png?v=[some_kind_of_hash]
I see other people have had the same problem when doing manual themes so they switched to the theming app to resolve the logo in the email which isn’t useful with multi-domain.
I’m assuming a function needs to be added to the theme’s default.php that updates the logo path?
Cheers!
hi
sorry to dig that out
i’m trying to understand what you have achieved here, not regarding the theming, but the usage you’re doing of it …
do you have a single nextcloud server running and multiple domains accessing it, with seperate users and databases for each domain? … that’s what i’m trying to do ^^
It just shows a diffrent theme depending on which domain is used to access it. It is still the same Nextcloud instance, just with a diffrent theming. There is no real segregation if you do it like that.
You can’t do that with a single Nextcloud instance. For what you are trying to achive, you have to setup multiple separate Nextcloud instances. It is possible to that on a single server, but each of them have to be hosted in their own directories / webroots. Just like if you were hosting one or multiple websites next to Nextcloud on the same server.
thanks a lot for your response
alas i couldn’t have a domain with cloudflare that accepts to be an alias … i’ll need to work it out …one more obstacle to simple life
i’m going to go with two different instances … as suggested
cheers