How redirect SOGo on root domain?

Hi, I’ve some trouble with my server in production. On the server we use SOGo for webmail and caldav. But since this morning the users can’t connect to SOGo, they are redirected to the main site, on the root of the domain. I’m not the only admin, and I don’t understand what happened. If someone have any idea it will be great.

do you mean that the admin/root’s credential are shared? in that case, login as root, and take a look at history and, of course, check your logs… (BTW, this is the first thing to do and you’d know it, coming from contribs’ forums :slight_smile: )

@zamboni I work in a small association , and unfortunately I’m the not the only admin sys, other have the passwork :’( , and they don’t have any idea of security. So I’m the one who repair the server every time they do somethings wrong.

About my issue, after some research and read a lot of documentation about nethserver and e-smith layer (I’m not an admin sys at the base, I dev in python and C/C++), so I’ve find how to get my main website back, and access to the SOGo on another domain name, and I’ve a question how to set a rewrite rules for SOGo in apache ?

Ps: Nethserver is great for a community server, in a small association, but when you’ve been habituate to centos 5/6 without any other interface than the ssh, it’s a bit complicated.

everything should work out of the box, so you’d tell us how is your server now to understand what’s wrong.

your request is too vague to have an answer :slight_smile:

I understant, so actually my server seem to work like that :

  • domain.tld => the main site
  • webmail.domain.tld/SOGo => the only access to SOGo
  • webmain.domain.tld => nothing work
    So what I need, is that webmail.domain.tld give access to SOGo, without any action for the users (because they are lazy).
    I don’t know if I’m not too vague again. But thanks for trying to understand what I write since yesterday.

was it working?

in any case, search here, I’m quite sure your issue has been discussed before

If I go to webmail.domain.tld I have the test page of apache, and nothing else, and I’haven’t find any documentation about this settings

I remember that it was discussed here… BTW, webmail.domain.tld pointing to SOGo is a customization, done via a httpd conf file, nothing you can find out of the box…

I don’t know if it still works but a special prop enables additional virtual hosts. Please see


I totally understand that is not setup out of the box, but I haven’t find where I can modify the conf file. I’ve done

config setprop sogod VirtualHosts webmail.domain.tld
signal-event nethserver-sogo-update

But not change, I still need to add /SOGo to my url.
Thanks for trying to help me

Your commands are OK, however I looked at /etc/e-smith/templates/httpd/vhost-default/30SOGo and the /SOGo location is expected. I understand it does not solve your issue.

Do you want to try this workaround?

  • install the File server module
  • create a shared folder and set it as web root of the webmail virtual host
  • add an index.php into the web root with the following content:
    header(‘Location: /SOGo’);
1 Like

Hi, thank you, it work great. My users are happy


I’m happy too :smile:

Add index.php with the following content:

<?php header('Location: /SOGo'); in /var/www/html/ without Fileserver

In a fresh NS 7.5.1804 I’m facing a comparable problem.

in the default root /var/www/html I’ve installed my
Redirect for nextcloud works like a charme, including the use of the letsencrypt certificate.
Redirect for SOGo gives the above problem, I still need to ad the ./SOGo to reach the page, but also the letsencrypt certificate is ignored. The certificate is multidomain and works for the other aliases as well as the installed vhost

Is there a solution so that I don’t have to ad any samba shares on this server to keep it a clean web/mail server?

Thanks for any reply.

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

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:/

<VirtualHost *:443>
 RedirectMatch ^/$
 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 \ 

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,


Hello Mark,

I came to this post over the thread you mentioned.

Regarding the certificate issue, it is imo related, I use a multidomain certificate but the set default letsencrypt certificate doesn’t get used due to the default certificate SOGo is taken account for in its config.

I followed your instructions and it works. So I also made the user template and put in the redirect as instructed. Also I commented out the lines in this user template of the SSLCertificateFile and SSLCertificateKeyFile. Result is a correct redirect and use of the correct multi domain certificate.

But what I expected by putting the question on line is the following:
Nextcloud installation was reached by https/ and after following the instructions in nextcloud manuall of nethserver (the same kind of instructions as for SOGo) I now reach the cloud server over without further redirect and in the same way my webdav listens to instead of

With SOGo there is a redirect from to so it isn’t quit as expected but it works.

I’ll start looking into the SOGo 3 threads and see if I can find there instructions regarding my wish.

Thanks for the quick support.


Please report back if you find a solution, as we know the /SOGo is mandatory :grinning:

1 Like

I created a card on the nethforge dashboard for the SOGo Vhost


to be honest the Redirect from / to /SOGo was always planned behavior.

BTW i think this is even better: (omit the host, we are already in https://<virtualhost>)

<VirtualHost *:443>
 ServerName $sogo_host
 RedirectMatch ^/\$ /SOGo
 SSLEngine on
1 Like