-1

I have a cloud VPS on which I am hosting a few sites on behalf of a few clients. My Apache is configured with VirtualHosts (I use Zpanel), so each site has its own root folder, and from the DNS settings I just add an A record from *.sitedomain.com to the server's IP.

I also run an email server (Postfix/Dovecot) to receive emails for these domains, and similarly I have the respective MX records for each site directing to the mailserver's IP.

All of this works fine. The websites resolve correctly and the emails get routed to the respective email accounts.

The final thing I wish to set up is webmail (using RoundCube). Is it possible in any way to have webmail.sitedomain.com redirect to the same website where RoundCube is hosted, for all the virtualhost sites? Roundcube is running on the same server and I can access it using either the primary domain of the server or the public IP address of the server.

What I wish is that when the URL starts with webmail, instead of redirecting to the virtual host folder it redirects to the webmail app. Is there a way to do it in Apache?

I am using Apache 2 web server, with ZPanel 10.1 on Ubuntu 12.04 LTS if it matters at all.

jbx
  • 93
  • 1
  • 10

1 Answers1

1

In your Apache setup you can create one main

ServerName webmail.sitedomain.com

Then add aliases to that name:

ServerAlias webmail.otherdomain.com webmail.friendsdomain.com ...

And they should all access the exact same site.

I have no clue whether ZPanel can do that for you...

Alexis Wilke
  • 2,210
  • 1
  • 20
  • 37