Turn roundcube to a virtual host

apache-2.2roundcubeubuntu-14.04

I am running my mail server on a Ubuntu 14.04 box without any issue.
To check emails I have installed roundcube using the deb packages with aptitude. The program was installed to /usr/share/roundcube and set up a conf in conf-available this way:

# Those aliases do not work properly with several hosts on your apache server
# Uncomment them to use it or adapt them to your configuration
    Alias /roundcube/program/js/tiny_mce/ /usr/share/tinymce/www/
    Alias /roundcube /var/lib/roundcube

# Access to tinymce files
<Directory "/usr/share/tinymce/www/">
      Options Indexes MultiViews FollowSymLinks
      AllowOverride None
      <IfVersion >= 2.3>
        Require all granted
      </IfVersion>
      <IfVersion < 2.3>
        Order allow,deny
        Allow from all
      </IfVersion>
</Directory>

<Directory /var/lib/roundcube/>
  Options +FollowSymLinks
  # This is needed to parse /var/lib/roundcube/.htaccess. See its
  # content before setting AllowOverride to None.
  AllowOverride All
  <IfVersion >= 2.3>
    Require all granted
  </IfVersion>
  <IfVersion < 2.3>
    Order allow,deny
    Allow from all
  </IfVersion>
</Directory>

Now on every domain hosted on this server, if I add /roundcube at the end of the url, I see the roundcube login page. As far as I know this is set by the first two lines in the conf file. I am not so strong in Apache configuration to see what should I do after commenting them to set up roundcube to be reachable only with a domain like webmail.my_mail_server.com
This domain resolves correctly to my mail server. The issue is only on the apache side.
Thanks for the help!

Best Answer

Assuming everything else is in place to do so (appropriate Listen and/or NameVirtualHost directives, DNS aliases, etc...), it should be as simple as wrapping the whole config contents inside a <VirtualHost> block, something like this:

<VirtualHost *:80>
  ServerName webmail.my_mail_server.com

  .... [exsiting config from above] ....

</VirtualHost>