Setting a virtual host of Sogo mail

sogo
virtualhosts
v7
mail

(Nitram Oneito) #1

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


(Jeroen Visser) #2

type the following in /var/www/html/

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

That should do the trick.


(Nitram Oneito) #3

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


(Jeroen Visser) #4

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:


(Nitram Oneito) #5

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


(Jeroen Visser) #6

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.


(Dan) #7

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

(Nitram Oneito) #8

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


(Jeroen Visser) #9

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:


(Mark Verlinde) #10

Good news for you!

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

grtz mark

EDIT:
don’t forget to update :grinning:


(Nitram Oneito) #11

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?


(Stéphane de Labrusse) #12

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


(Stéphane de Labrusse) #13

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


(Nitram Oneito) #14

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


(Stéphane de Labrusse) #15

nethserver-sogo :slight_smile:


(Nitram Oneito) #16

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


(Dan) #17

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


(Nitram Oneito) #18

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


(Dan) #19

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.


(Nitram Oneito) #20

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