Link to home
Start Free TrialLog in
Avatar of PastorDwayne
PastorDwayne

asked on

Apache2 Name Virtual host

Good-day;
 I have an Apache2 web server on Debian.

I have two sites pointing to the same ip: www.mycompany.com and email.mycompany.com...

The email.mycomany.com is the webmail and runs using SSL certs.

My question is, how do I configure these Virtual hosts so that when I type email.mycompany.com into my browser it opens the secure webmail, but if I type www.mycompany.org it direct me to the default web page.

Thanks for your time


Avatar of Zoidling
Zoidling

Not sure how to achieve what you describe using a single IP (since you can't specify a port in DNS), but can suggest a more common alternative:

In DNS, point www.mycompany.com to your web server's IP.  On that site provide a http://www.mycompany.org/webmail page that redirects the user to https://your_webmail_virtual_host.  If you're running your secure webmail site on a non-standard port, say port 8088, your redirect would be to http://your_webmail_virtual_host:8088.
apache does support NameBasedVirtualHost that is you can have more that one websites for an IP I hope you already knew that. The default www.mycompany.com can be configured without any issues right. for the second mail.mycompany.com put a php file or some thing that will redirect the request to https://mail.mycompany.com. You can also use apache's mod_rewrite to achive this but using php will be easier.

--
Cheers,
Sivam
www.emmeskay.com
ASKER CERTIFIED SOLUTION
Avatar of TimEliseo
TimEliseo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PastorDwayne

ASKER

Thanks!