[SOLVED] How do I do this - webmail and roundcube on the host, without a virtual server?

11 posts / 0 new
Last post
#1 Mon, 11/05/2018 - 10:45
Nunnsby

[SOLVED] How do I do this - webmail and roundcube on the host, without a virtual server?

1) I am just really struggling to setup the webmail to use https://webmail.domain.com with roundcube
2) How do I install roundcube if I am not using a virtual server?
- I have tried manually installing roundcube via download and attempting to get it working in the directory the webmail is pointing to, but that is not working.

This is what I am trying to do:
- send all mail from mail.domain.com = "mail".domain.com NOT mail-1.domain.com (the actual hostname)
- use CENTRAL WEBMAIL (roundcube) on https://webmail.domain.com
- NOT :20000 and NOT /roundcube

This is what I have:
- domain (QDN) = domain.com
- DNS points both mail-1 and mail to same host
- hostname = mail-1.domain.com
- /etc/hostname = mail-1
- /etc/hosts = 127.0.0.1 mail-1.domain.com mail-1 localhost

I have configured Webmin Configuration to get SSL Cert via Let's encrypt for mail.domain.com
- this is working for https://mail.domain.com (using virtual server)
- so I access webmin/vmin admin interface on https://mail.domain.com:12345
- I have copied the certs to postfix and dovecot and they are working fine too

I will eventually add additional domains for email, but they should all
- 1) send mail through the mail.domain.com mail server
- 2) use roundcube on https://webmail.domain.com

Having played with iredmail before you can actually setup a mail domain using the same QDN as the host sits on (host (FQDN) = mail-1.domain.com / QDN = domain.com). On VirtualMin if you try setup a virtual server using the DQN (domain.com) on a host that is using mail-1.domain.com it causes all sorts of problems.

Any assistance please? Or tell me what I am doing wrong. :(

Mon, 11/05/2018 - 14:10
marcelorp

Dont understand too much what you want...you are using Virtualmin or just Webmin? Did you have a virtualserver for your domain.tld? And want to create that subdomain (without creating another virtualserver) to get roundcube running on it? You are using apache or nginx?

Mon, 11/05/2018 - 14:31
Nunnsby

I guess I wasn't very precise here. So I have: ubuntu 18.04.1 & virtualmin from shell install.

HOST = mail-1.domain-1.com
LOOKING FOR:
- https://webmail.domain-1.com = roundcube
- smtp for all domains from mail-1.domain-1.com using LetsEncrypt (LE) cert

Then I will configure
- virtual-server = domain-2.com
- user@domain-2.com
- point users for pop3/imap/smtp > mail-1.domain-1.com - using LE cert
- point users for webmail > https://webmail.domain-1.com = roundcube

Just can't get the roundcube working. Basically trying to install webmail at the root of the host domain with roundcube working.

Mon, 11/05/2018 - 14:37
marcelorp

I have this setup here and working normally.

What you use for web access? apache or nginx? can you provide your configs to that?

Mon, 11/05/2018 - 14:41
Nunnsby

Hi, I use Apache. What configs do you require? I have destroyed my system so many times in the last 3 days now I am starting from scratch again. Let me get the host running and I will share what you need.

Mon, 11/05/2018 - 14:54
marcelorp

I don't known how to add that on Apache, just on Nginx.

What is do is that:

  • Create an A record with name webmail pointing to your IPv4, the same of the main domain.
  • On nginx I added this configuration:
server {

    listen 80;
    server_name webmail.domain.io;
    return 301 https://webmail.domain.io$request_uri;

}
server {

    listen 443 ssl http2;
    server_name webmail.domain.io;
    root /home/domain/webmail/public_html;
    ssl_certificate /home/domain/ssl.cert;
    ssl_certificate_key /home/domain/ssl.key;

    # Logs
    access_log off;
    error_log /home/domain/webmail/logs/webmail_error_log;

    # Protection
    location ~ "^/(?!installer|\.well-known\/|[a-zA-Z0-9]{16})(\.?[^\.]+)$" {
        deny all;
    }

    location ~ ^/?(\.git|\.tx|SQL|bin|config|logs|temp|tests|program\/(include|lib|localization|steps)) {
        deny all;
    }

    location ~ ^/vendor\/bin\/.* {
        deny all;
    }

    location ~ /?(README\.md|composer\.json-dist|composer\.json|package\.xml|jsdeps.json|Dockerfile)$ {
        deny all;
    }

    location = /favicon.ico {
        root /home/codebr/webmail/public_html/skins/larry/images;
    }

    # Block Robots
    add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
    location = /robots.txt {
        add_header Content-Type text/plain;
        return 200 "User-agent: *\nDisallow: /\n";
    }

    # CodeBR.io
    include /etc/marcelorp/nginx/default.conf;
    include /etc/marcelorp/nginx/cache.conf;

    location ~ \.php$ {
        include /etc/marcelorp/nginx/fastcgi.conf;
        fastcgi_pass unix:/run/php-fpm/webmail.sock;
    }

}



So now I have the subdomain pointed to my IPv4 and my Nginx configuration receiving that and pointing to webmail folder, and in my clients I just redirect all the webmail.clientdomain.tld to my webmail.domain.tld.
In Apache should be the same logic, I prefer Nginx...its more simple and fast.

Mon, 11/05/2018 - 17:39
Nunnsby

Thanks marcelorp! Your config helped me solve my issue. Still using Apache. But this is what I have been doing wrong ... I haev been using webmin to try and manage the certs for the host system ... absolute nightmare!!!!!

So, I create a virtual server, and set up the certs in the there for : domain.com; hostname.domain.com; mail.domain.com, webmail.domain.com. I have applied those to webmin, usermin, dovecot, postfix, proftpd.

I have installed roundcube in the root of the virtual-server domain.com.

I have also hashed out the directives in both the 80 and 443 domain.com virtual server files

#RewriteCond %{HTTP_HOST} =webmail.domain.com
#RewriteRule ^(.) https://domain.com:20000/ [R]
#RewriteCond %{HTTP_HOST} =webmail.domain.com
#RewriteRule ^(.
) https://domain.com/ [R]

I have also set the server template for apache to point the webmail to https://webmail.domain.com

OMG ... so relieved, finally working.

:)

Mon, 12/17/2018 - 04:54 (Reply to #7)
assad

Good to hear that. I want PhpMyadmin and webmail as centralized so that users dont need to install from scripts for each account. Can you guide me with step by step instructions as i am not very familiar with the virtualmin.

Note: A video tutorial will help many starters as this is a very common question among virtualmin users.

Mon, 11/05/2018 - 17:41
marcelorp

Im glady I can help you figure out what was the problem...about the certs...I do the same thing...its more easier and no errors here.

Tue, 11/06/2018 - 09:53
jimdunn

@Nunnsby, when you said...

So, I create a virtual server, and set up the certs in the there for :
domain.com; hostname.domain.com; mail.domain.com, webmail.domain.com.
I have applied those to webmin, usermin, dovecot, postfix, proftpd.


... did you create subdomains and end up with 4 certs total for the "domain.com" domain... and which of the 4 did you apple to "webmin, usermin, dovecot, postfix, proftpd" ???

Thx!

Tue, 11/06/2018 - 14:47
Nunnsby

@jimdunn, Using LE (let's Encrypt) you should get a single cert for all 4. Single domain name, with 3 sub domains included.

  • Virtual Min > go to Virtual Server Profile that has the SSL Site enabled
  • Server Configuration > Manage SSL Certificate
  • Let's Encrypt > Domains listed here:
    • domain.com
    • hostname.domain.com
    • mail.domain.com
    • webmail.domain.com
  • Months between automatic renewal = 2

Then, when you do it first time and it completes, you "should" get the option to apply that cert with all 4 names included to webmin/usermin/etc. I say should as I think that is where it happened.

You may have to do the redirect for the webmail first as it may not work straight out of the box, until I had the webmail point to the root.

Topic locked