How redirect SOGo on root domain?

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:
    <?php
    header(‘Location: /SOGo’);
1 Like

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

2 Likes

I’m happy too :smile:

Add index.php with the following content:

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

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

in the default root /var/www/html I’ve installed my www.domain.nl
Redirect cloud.domain.nl for nextcloud works like a charme, including the use of the letsencrypt certificate.
Redirect webmail.domain.nl 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 www.otherdomain.nl.

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.
Guus

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

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/www.domain.nl/nextcloud 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 https://cloud.domain.nl without further redirect and in the same way my webdav listens to https://cloud.domain.nl/remote.php/webdav instead of https://www.domain.nl/nextcloud/remote.php/webdav

With SOGo there is a redirect from https://webmail.domain.nl to https://webmail.domain.nl/SOGo 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.

Guus

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

Nice!

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

If you have time and the willingness, a PR is welcomed and really pleased

1 Like

done, some doc update too

2 Likes

@mark_nl could you please test the issue https://github.com/NethServer/dev/issues/5541#issuecomment-402553395

The commit you did redirect ‘/’ to /SOGo, but a side effect exists, the SOGo.conf vhost becomes the default vhost and all vhost are redirected to /SOGo. Hence I moved the sogo.conf to zzz_SOGO.conf

[root@prometheus ~]# httpd -S
VirtualHost configuration:
*:80                   is a NameVirtualHost
         default server webmail.aubrac-medical.com (/etc/httpd/conf.d/SOGo.conf:10)
         port 80 namevhost webmail.aubrac-medical.com (/etc/httpd/conf.d/SOGo.conf:10)
         port 80 namevhost webmail.de-labrusse.fr (/etc/httpd/conf.d/zz_SOGo.conf:10)
*:443                  is a NameVirtualHost
         default server webmail.aubrac-medical.com (/etc/httpd/conf.d/SOGo.conf:18)
         port 443 namevhost webmail.aubrac-medical.com (/etc/httpd/conf.d/SOGo.conf:18)
         port 443 namevhost prometheus.de-labrusse.fr (/etc/httpd/conf.d/nethserver.conf:42)
         port 443 namevhost prometheus.de-labrusse.fr (/etc/httpd/conf.d/ssl.conf:56)
         port 443 namevhost webmail.de-labrusse.fr (/etc/httpd/conf.d/zz_SOGo.conf:18)

hi will look in it tomorrow,

Don’t see this behavior, but could be I do not understand correctly

default server xxx.xxx.lan (/etc/httpd/conf.d/SOGo.conf:18)

sogo is the default vhost, it should /etc/httpd/conf.d/nethserver.conf

I beginning to get it, alphabet :relieved:

EDIT:
No i do not get it see wat you meen, don’t get why

With your commit if you take two vhost lets say

Sub1.domain.com
Sub2.domain.com

Twe two are redirected to /SOGo even if you use only sub1.domain.com in the apache sogo configuration.

This is done when you have several web app configured and when your apache configuration is taken as the default one. We have configured like this mattermost, dokuwiki, nextcloud and now SOGo by naming the apache configuration to zz_*. Like this the nethserver.conf become the default vhost

I need to check WordPress

2 Likes

Hi, i get it now!
and was typing here:

this is getting OT, sould we open a new thread?

I love OT…my life is out topic :smiley:

lets close the sogo bug if you agree and start a new talk on the 000-nethserver.conf…since you raised your hand, please shoot first to start a discussion on discourse

1 Like

done…