Koozali.org: home of the SME Server

Webmail.domain.com Virtual Host?

Offline harshl

  • *
  • 32
  • +0/-0
Webmail.domain.com Virtual Host?
« on: March 11, 2006, 10:17:13 PM »
I would like to create a Virtual host for webmail as a host header, so when people go to webmail.domain.com they are taken to the IMP web interface.
I have added the following via templates-custom:
/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/32WebmailAlias

<VirtualHost 0.0.0.0:80>
ServerName webmail.domain.com
DocumentRoot "/home/httpd/html/horde"
Alias /horde "/home/httpd/html/horde"
RewriteEngine On
RewriteRule ^/(.*)https://webmail.domain.com:443/$1 [L]
Redirect / https://webmail.domain.com
</VirtualHost>

This does not work at all, I assume because I need another virtualhost with the same name in an SSL section. I think that is the case because if I remove the rewrite and redirect lines it works with the exception that no graphics load.

I tried adding:
/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/33WebmailSSLAlias

<VirtualHost 0.0.0.0:443>
ServerName webmail.domain.com
DocumentRoot "/home/httpd/html/horde"
Alias /horde "/home/httpd/html/horde"
</VirtualHost>

This did not help at all.

I have another virtualhost that is working fine, though it does not involve SSL:
/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/31MusicAlias

<VirtualHost 0.0.0.0:80>
ServerName music.domain.com
DocumentRoot "/home/e-smith/files/ibays/ampache/html"
Alias /ampache "/home/e-smith/files/ibays/ampache/html"
</VirtualHost>

Can anyone offer any advice on how to get the webmail virtual host working?

Thank you,

-Landon
-Landon

Offline harshl

  • *
  • 32
  • +0/-0
Webmail.domain.com Virtual Host?
« Reply #1 on: March 14, 2006, 05:20:16 PM »
Is there a more appropriate forum to post this in?

Thanks,

-Landon
-Landon

asgeir

Virtualhost for webmail.example.com
« Reply #2 on: August 23, 2006, 08:38:54 PM »
Dont know if this is relevant any more, but i'll add my solution to this question.

First, go to the directory for the httpd.conf templates:

cd /etc/e-smith/templates/etc/httpd/conf/httpd.conf

Then edit the file 80VirtualHosts

pico 80VirtualHosts

At the end of that file, after the last }, add this:

-----snip------

<VirtualHost 0.0.0.0:80>
ServerName webmail.example.com
DocumentRoot /home/httpd/html/horde/imp
Alias /horde /home/httpd/html/horde
RewriteEngine on
RewriteCond %\{SERVER_PORT\} !^443$
RewriteRule ^.*$ https://%\{HTTP_HOST\}$1 [L,R]
</VirtualHost>

<VirtualHost 0.0.0.0:443>
SSLEngine on
ServerName webmail.example.com
DocumentRoot /home/httpd/html/horde/imp
Alias /horde /home/httpd/html/horde
</VirtualHost>

-----snip-----

This will enable webmail.example.com as a virtual host. The alias is needed to find all graphics, templates and other stuff. Also, by adding one vhost for port 80 with rewrite rules to port 443 and one vhost for port 443, webmail.example.com will allways be https.

Note the \ before the brackets in the rewrite rules. These hare neccessary, or else the scripts for expanding the template will fail to parse the brackets.

After you've done this, simply issue:

signal-event email-update

or

expand-template /etc/httpd/conf/httpd.conf
/etc/init.d/httpd-admin restart

Witch will reconfigure some stuff, including expanding the httpd.conf file and restart the webserver i think. (seems to work anyway).

Test.

Offline pfloor

  • ****
  • 889
  • +1/-0
Webmail.domain.com Virtual Host?
« Reply #3 on: August 24, 2006, 11:01:48 AM »
You need to put this in the templates-custom directory.  If an update changes that template, you will lose your changes.  I tried this and put it in a custom template and named it 80WebmailRedirect and it worked.

You will however run into a problem with your server's certificate, it won't match the address as the cert is host.domain.com and the web address is webmail.domain.com.

This has become a big deal lately especially with the new IE7.  If any of your users try to connect using IE7 it blasts them with the following very ugly warning:



Even after accepting and installing the cert, IE7 still shows the address bar in red like this:

In life, you must either "Push, Pull or Get out of the way!"

Offline compdoc

  • ****
  • 211
  • +0/-0
Webmail.domain.com Virtual Host?
« Reply #4 on: October 30, 2006, 05:01:10 PM »
My IE7 displayed those warnings and address bar at first, but then disabled them by itself after a while. It seemed to watch what I did and decided I didnt care about certificates...

Offline ltwally

  • ***
  • 108
  • +0/-0
Re: Webmail.domain.com Virtual Host?
« Reply #5 on: May 07, 2009, 01:22:04 AM »
I just attempted this with SME 7.4, and though it created the appropriate entries in /etc/httpd/conf/httpd.conf, it did not open up the webmail.  Instead, it opened up the primary ibay's website.

Any ideas on how to do this for SME 7.4 ?

Thanks!