Setting a virtual host of Sogo mail

NethServer Version: Latest
Module: sogo

How can I configure mail.domain.com to open sogo groupware, instead of domain.com/SOGo

can this be done with the virtual host system, or do I have to achieve this using ssh

type the following in /var/www/html/

echo “<?php header('Location: /SOGo'); ?>” >> ./index.php

That should do the trick.

am not following, now am confused. in the /var/www/html/ there is no other file except a file named wpad.dat, so where and how do I add that script

if you type exactly that, it will echo the part between " " to the file index.php

In essence, it will create the file index.php in /var/www/html and will write the line ‘<?php header('Location: /SOGo'); ?>’ in it.

This will redirect all traffic landing on the webroot, to /SOGo 
 what you asked for :wink:

but I don’t want all traffic to redirect to sogo, I only want traffic from mail.domain.com to redirect to sogo

This will only affect the webroot of the server you are on. I presume this server only hosts SOGo. If not, then I am unsure how to proceed.

That does not seem like a reasonable thing to presume.

Something like this:

  • Create a virtualhost for mail.yourdomain
  • Put that redirect file in /var/lib/nethserver/vhost/mail/index.php, rather than /var/www/html/index.php
3 Likes

the server hosts sogo, nextcloud, rpamd and some other tools

I make that assumption based on best practices to isolate mailservers form other servers.

and I feel stupid for not thinking of name based vhosts :confused:

Good news for you!

here is how-to (section Access SOGo on an exclusive hostname)

grtz mark

EDIT:
don’t forget to update :grinning:

SSL SECURITY ERROR

After creating the virtual host, I tried to request a lesencrypt certificate, but after installing, it does not show on the website, but when I set it as default, the other domain for nethserver does not have ssl. is there a way of setting each cert as default for its respective domain?

Check the documentation at http://docs.nethserver.org/en/latest/sogo.html#access-sogo-on-an-exclusive-hostname

Could we have some logs of the error with letsencrypt please and reformulate your issue because I am a bit lost

Please upgrade, I added a commit to redirect the acme-challenge from 80 to 443 (like for other module, nextcloud, mattermost, dokuwiki
)

I am lost, what do I need to upgrade, sogo or nethserver?

nethserver-sogo :slight_smile:

I have installed the updates, but I do not see some differences.
let me try to be more clear

I configured the virtual host, the inserted the script

After doing that, I was now able to go to https://mail.domain.com
I was able to visit the page successfully.
lestencrypt was not present so I went to server certificates and requested for one.
ater requesting, when I visit the mail.domain.com its as if the certificate is not present, but when I change the defult cert to the one for mail.domain.com it works, without it being default, it does not work.

is there no way to have both certs as default, in there respective subdomains? or just have them to work

No. You instead need to get one cert that covers all relevant hostnames.

so how do I get one cert that covers all hostnames in nethserver, from letsencrypt

Simply enter all hostnames in the “Domains” text box when you request the Let’s Encrypt cert: “mydomain.com, www.mydomain.com, mail.mydomain.com”, etc.

SOLUTION FOR REQUESTING MUTLIPLE LetsEncrypt SSL

under the server ssl, I set each subdomain on its own line, the once the cert was requested, I was able to set it as the default certificate and it worked

1 Like