[horde] Virtual host and Themes

poubeline at free.fr poubeline at free.fr
Tue Jul 11 13:34:06 UTC 2017


Hi All, 

I am a new member to this Horde mailling list. Thanks for welcoming me on this list. 

I am requesting help on a subject that I think is configurred correctly but that is not working well. 

I explain what is going on : 
I have installed the latest horde version on a Debian 8.8 server which is functionning perfectly for a single domain. 
I have followed the examples in the Horde's "How To's" for installation using PEAR and all is OK. 

Now, I would like to prepare this installation for a new domain. I have already configured Horde to use Virtual Host and the Apache configuration works perfectly. 

The only issue here is that if I use a specific theme for one virtual host and another theme for the other virtual host, the "favicon" and the branding name of the Horde project is always set to the second theme, even if the virtual host reached is the first one. 

My configuration is as following : 
Apache : 
/etc/apache2/sites-available/webmail.<domain1>.fr.conf 


<VirtualHost *:80> 
DocumentRoot /var/www/horde 
ServerName webmail.<domain1>.fr 
ServerAdmin webmaster@<domain1>.fr 

RewriteEngine on 
RewriteCond %{HTTPS} !=on 
RewriteRule ^/(.*)$ https://%{SERVER_NAME}/$1 [R=permanent] 
</VirtualHost> 

<VirtualHost *:443> 
DocumentRoot /var/www/horde 
ServerName webmail.<domain1>.fr 
ServerAdmin webmaster@<domain1>.fr 

SSLEngine On 
SSLCertificateFile /etc/ssl/certs/mail.<domain1>.fr.crt 
SSLCertificateKeyFile /etc/ssl/private/mail.<domain1>.fr.key 

Alias /horde /var/www/horde 

<Directory /var/www/horde> 
Options +FollowSymLinks 
AllowOverride All 
Require all granted 
AddType application/x-httpd-php .php 
php_value include_path ".:/usr/share/php" 
php_value open_basedir "none" 
php_value upload_tmp_dir "/var/www/horde/phptmp/" 
</Directory> 
</VirtualHost> 



/etc/apache2/sites-available/webmail.<domain2>.com.conf 

<blockquote>
<VirtualHost *:80> 
DocumentRoot /var/www/horde 
ServerName webmail.<domain2>.com 
ServerAdmin webmaster@<domain2>.com 

RewriteEngine on 
RewriteCond %{HTTPS} !=on 
RewriteRule ^/(.*)$ https://%{SERVER_NAME}/$1 [R=permanent] 
</VirtualHost> 

<VirtualHost *:443> 
DocumentRoot /var/www/horde 
ServerName webmail.<domain2>.com 
ServerAdmin webmaster@<domain2>.com 

SSLEngine On 
SSLCertificateFile /etc/ssl/certs/webmail.<domain2>.com.crt 
SSLCertificateKeyFile /etc/ssl/private/webmail.<domain2>.com.key 

Alias /horde /var/www/horde 

<Directory /var/www/horde> 
Options +FollowSymLinks 
AllowOverride All 
Require all granted 
AddType application/x-httpd-php .php 
php_value include_path ".:/usr/share/php" 
php_value open_basedir "none" 
php_value upload_tmp_dir "/var/www/horde/phptmp/" 
</Directory> 
</VirtualHost> 

</blockquote>

Horde : 
/var/www/horde/config/prefs.d/prefs-webmail.<domain1>.fr.php 

<blockquote>
<?php 

// *** Personal Information (Identities) Preferences *** 

$_prefs['theme']['value'] = 'DOMAIN1'; 
$_prefs['theme']['locked'] = true; 
$_prefs['initial_application']['value'] = 'imp'; 
$_prefs['language']['value'] = 'fr_FR'; 
$_prefs['language']['locked'] = true; 
$_prefs['portal_layout']['locked'] = true; 

</blockquote>

/var/www/horde/config/prefs.d/prefs-webmail.<domain2>.com.php 

<blockquote>
<?php 

// *** Personal Information (Identities) Preferences *** 

$_prefs['theme']['value'] = 'DOMAIN2'; 
$_prefs['theme']['locked'] = true; 
$_prefs['initial_application']['value'] = 'imp'; 
$_prefs['language']['value'] = 'fr_FR'; 
$_prefs['language']['locked'] = true; 
$_prefs['portal_layout']['locked'] = true; 

</blockquote>

/var/www/horde/config/registry.d/registry-webmail.<domain1>.fr.php 

<blockquote>
<?php 

// *** Personal Information (Identities) Preferences *** 

$this->applications['horde']['name'] = "Webmail DOMAIN1"; 

</blockquote>

/var/www/horde/config/registry.d/registry-webmail.<domain2>.com.php 

<blockquote>
<?php 

// *** Personal Information (Identities) Preferences *** 

$this->applications['horde']['name'] = "Webmail DOMAIN2"; 

</blockquote>

So, if in a web browser I type the URL "https://webmail.<domain1>.fr" the name displayed for this web site is "Webmail DOMAIN1" with the favicon.ico from the ' DOMAIN1' theme, but after loging in or even doing a refresh of the web site, I get the web site name changed to "Webmail DOMAIN2" with the favicon.ico of the ' DOMAIN2' theme. 

If I remove the DOMAIN2 configuration files in prefs.d and registry.d, all is back and fine for DOMAIN1 with the correct name and favicon.ico icon. 
As I was thinking of a mix between cookies for each different sites, I have even tried to add a conf-webmail.<domain1>.fr.php and a conf-webmail.<domain2>.com.php files in /var/www/horde/config folder to override the $conf['server']['name'] and $conf['cookie']['domain'] values to be specific for each domain, but I did not get any better display. 

For tracing purpose, I have also created a phpinfo.php file that I have added to the /var/www/horde folder and with which I can test the different php values for each sites, and the $_SERVER['SERVER_NAME'] php value used for the $conf['server']['name'] and $conf['cookie']['domain'] values is well set with webmail.<domain1>.fr and webmail.<domain2>.com depending on the site URL I am accessing to. 

Does anyone have faced this kind of issue when having 2 sites for 2 different domains on the same server? All I want is to be able to display a different name and a different favicon.ico icon for each domain. 

If anyone have a clue on this, let me know. 

All the best, 
Moody_Styley 




More information about the horde mailing list