How redirect SOGo on root domain?

Hi Guus,

This is a old post and there for not every accurate;

Did you see this thread?

I think it’s better you explain the certificate issue in a separate post…:grinning:

Quite a while ago tried to accomplish this, never succeeded with the all the (reverse) proxing to the localhost port of sogod. I think I cracked it now, could you test this?

First set up SOGo to listen to its own virtual host

config setprop sogod VirtualHost webmail.domain.nl

signal-event nethserver-sogo-update

To get back to the default configuration

config setprop sogod VirtualHost Default

signal-event nethserver-sogo-update

for a quick test we edit /etc/httpd/conf.d/SOGo.conf
and add the line RedirectMatch ^/$ https:/webmail.domain.nl/SOGo

….
<VirtualHost *:443>
 ServerName webmail.domain.nl
 RedirectMatch ^/$ https://webmail.domain.nl/SOGo
 SSLEngine on
 SSLCertificateFile "/etc/pki/tls/certs/localhost.crt"
 SSLCertificateKeyFile "/etc/pki/tls/private/localhost.key"
….

Load the new apache config, and test if this work for you!

systemctl reload httpd

KEEP IN MIND !: the next time nethserver-sogo-update runs your custom config is lost!

To make your custom configuraton stick you could make a custom-template:

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf.d/SOGo.conf/

copy SOGo’s default apache template to the custom location

cp /etc/e-smith/templates/etc/httpd/conf.d/SOGo.conf/10base \ 
/etc/e-smith/templates-custom/etc/httpd/conf.d/SOGo.conf/.

Edit /etc/e-smith/templates-custom/etc/httpd/conf.d/SOGo.conf/10base
Add add the line RedirectMatch ^/\$ https://$sogo_host/SOGo
(note the escape \ before $)

…..
<VirtualHost *:443>
 ServerName $sogo_host
 RedirectMatch ^/\$ https://$sogo_host/SOGo
 SSLEngine on
 SSLCertificateFile "/etc/pki/tls/certs/$sogo_cert.crt"
 SSLCertificateKeyFile "/etc/pki/tls/private/$sogo_cert.key"
….

signal-event nethserver-sogo-update
and check if your custom template expaned well!

less /etc/httpd/conf.d/SOGo.conf

Happy hacking,
Mark

3 Likes