1 (edited by der_mythos 2012-02-22 20:42:49)

Topic: Setting up Virtualhost for iredMail

==== Provide required information to help troubleshoot and get quick answer ====
- Linux/BSD distribution name and version: Debian Squeeze
- iRedMail version and backend (LDAP/MySQL): MySql
- Any related log? Log is helpful for troubleshooting. /
====

Hi folks,

I installed iRedMail on my webserver but my Website is also running on this server, so I need to get the Apache work for both environments.

ATM I can reach my site at: example.com but if I visit www.example.com it won't work anymore (but it did in the past).

So I think I have to set up the virtual host right?

What are the steps to go through?

At first I think I would need to delete the Files in /etc/apache2/conf.d/ ?
Then setting them up again in a nice way, like in /etc/apache2/sites-availibile/?

Ok, if I go through this steps I can't really figure out, what data I need to put in the VirtualHost configuration.
I think there has to be some examples out there? I can't be the only one whos struggling with this right?


Best regards Robin.

2

Re: Setting up Virtualhost for iredMail

iRedMail doesn't know what applications you're going to run, and default Apache web server doesn't contains your web files.

I guess what you need to do is just make these web applications work under current Apache setting, it should be easy. So please explain what web applications you ran on website before.

3

Re: Setting up Virtualhost for iredMail

ZhangHuangbin wrote:

iRedMail doesn't know what applications you're going to run, and default Apache web server doesn't contains your web files.

I guess what you need to do is just make these web applications work under current Apache setting, it should be easy. So please explain what web applications you ran on website before.


Hi Zhang,
thank you for participatng. It's nothing special. I'm running a Symfony Web-Application as well on the Server. So what I want to do is:
If you visit: example.com or www.example.com to be referenced to my web-Application
If you visit: example.com/mail or www.example.com/mail to be referenced to the RoundCube-Login and so on.

So I have the virtual-host Setup working for my Web-Application. The Problem is I don't know exactly how to setup the VHost for the Mail-Server as well. Where is the config for the routing to the IRedMail components right now? How to move them the right way?


With best regards Robin

4

Re: Setting up Virtualhost for iredMail

Apache DocumentRoot is /var/www/, so you can copy your Symfony web application to /var/www/, and it should now be available when you access example.com.

5

Re: Setting up Virtualhost for iredMail

ZhangHuangbin wrote:

Apache DocumentRoot is /var/www/, so you can copy your Symfony web application to /var/www/, and it should now be available when you access example.com.

Hi,

yes I know. And this works. My Problem is: when I visit www.example.com I just get redirected to the "It works" .html of apache. And I want the webapp to be availibile with www.example.com and example.com

Thank you in advance Robin

6

Re: Setting up Virtualhost for iredMail

Hi,

You can use the ServerAlias directive to achieve this.

/etc/apache2/sites-enabled/000-default:

<VirtualHost *:80> 

ServerName example.com 
ServerAlias *.example.com
DocumentRoot /var/www/
...
</VirtualHost>

7

Re: Setting up Virtualhost for iredMail

ricklous wrote:

Hi,

You can use the ServerAlias directive to achieve this.

/etc/apache2/sites-enabled/000-default:

<VirtualHost *:80> 

ServerName example.com 
ServerAlias *.example.com
DocumentRoot /var/www/
...
</VirtualHost>

Thank you very much! The wildcard in front of the ServerAlias worked like a charm. Now everything seems fine smile

Thank you. I really appreciate the iRedMail Project.