Apache: Name-based virtual servers not working

Discuss installation of Scalix software

Moderators: ScalixSupport, admin

quacka
Posts: 36
Joined: Tue Aug 15, 2006 4:30 am

Apache: Name-based virtual servers not working

Postby quacka » Mon Sep 18, 2006 1:55 am

Hi,

I am new to Scalix and wonder if scalix is not compatible with named based virtual server in Apache. I added virtual servers as below and it don't seem to work for me:

Code: Select all

<VirtualHost *:80>
ServerName mail2.mydomain.com.au
DocumentRoot /var/www/html/mainqfl
</VirtualHost>

<VirtualHost *:80>
ServerName mail.mydomain.com.au
DocumentRoot /var/www/html/mail2
</VirtualHost>


Somehow the page always defaults to /var/www/html/mail2

florian
Scalix
Scalix
Posts: 3852
Joined: Fri Dec 24, 2004 8:16 am
Location: Frankfurt, Germany
Contact:

Postby florian » Mon Sep 18, 2006 2:49 am

I can't give you the exact answer on what you need to do, but Scalix is certainly "compatible" with name-based virtual hosts.

Note that Scalix does not really host any content on Apache itself; it hooks into Apache by means of the mod_jk Apache-Tomcat connector. So my working assumption is that our default mod_jk configuration that we add to the Apache config isn't in the right place to apply to your named virtual host....

Cheers,
Florian.
Florian von Kurnatowski, Die Harder!

quacka
Posts: 36
Joined: Tue Aug 15, 2006 4:30 am

Postby quacka » Mon Sep 18, 2006 3:12 am

Must be something weird about Apache then.

If I upgrade my apache to the latest version. Will Scalix stillw ork fine?

florian
Scalix
Scalix
Posts: 3852
Joined: Fri Dec 24, 2004 8:16 am
Location: Frankfurt, Germany
Contact:

Postby florian » Mon Sep 18, 2006 3:16 am

What Linux distro are you using? We've certified Scalix to work with the version that comes with the (supported) operating system.

I also don't think that it is a basic problem of a specific Apache version - all versions since 1.2 should do that fine. I'd research the configuration (which, given that it is Apache, is complex....)

Florian.
Florian von Kurnatowski, Die Harder!

quacka
Posts: 36
Joined: Tue Aug 15, 2006 4:30 am

Postby quacka » Mon Sep 18, 2006 3:28 am

RHEL4 ES

From fresh installion, I just add another file called defaultwebsite.conf inside /etc/httpd/conf.d/

Mail2 directory basically have a index.html which forward the page to mail.mydomain.com.au/webmail

and /var/www/html/mainqfl is where our home page reside

florian
Scalix
Scalix
Posts: 3852
Joined: Fri Dec 24, 2004 8:16 am
Location: Frankfurt, Germany
Contact:

Postby florian » Mon Sep 18, 2006 3:31 am

ok, you will find our config files in /etc/opt/httpd/conf.d/*scalix*. You will have to make sure that those properly work with your virtual host conf.

I can't give you any more details, as I'm not an Apache guy, but maybe someone else can chime in how to debug this.

Florian.
Florian von Kurnatowski, Die Harder!

quacka
Posts: 36
Joined: Tue Aug 15, 2006 4:30 am

Postby quacka » Mon Sep 18, 2006 3:37 am

Thanks for your time.

The scalix webmail works fine.
I am just adding another name-based virtual server

cboyer

Finally, I Solved This...

Postby cboyer » Sat Dec 23, 2006 12:21 am

Hello all, and thanks for a fine product. It's very much appreciated that their is a community edition that's so professional in both function and appearance.

Regarding the Virtual Hosts not working, I have finally (after several hours) come up with a workaround, albeit an inelegant one. I think that the problem is a two headed monster, but have not had time to completely parse the system logs to prove myself right or wrong.

First of all, my system is Centos 4.4 using Apache 2.0.52.

It seems that if you try to edit your httpd.conf to install VirtualServers and the applicable directives, you are wasting your time.

That said, simply comment out any and all VirtualServer directives in your httpd.conf.

Copy a backup and then edit the file that has the last say:

/etc/opt/scalix-tomcat/connector/jk/instance-myserver.conf

There, to quote Dylan, the times are a changin':

Add the NameVirtualHost directive:

NameVirtualHost *:80

Then add your default web server.


<VirtualHost *:80>
ServerName www.my_first_domain.com
ServerAlias my_first_domain.com *.my_first_domain.com
Include /etc/opt/scalix-tomcat/connector/jk/app-myserve.*.conf
<-- no need to change
#Set the Doc root to your default server's directory, whatever that happens to be
DocumentRoot /htdocs/my_first_domain
ServerAdmin unappreciated_admin@my_first_domain.com
ServerSignature email
#Let 'em get the index files
DirectoryIndex index.php index.html index.htm index.shtml
LogLevel warn
HostNameLookups off
</VirtualHost>


And there you have the default set. Note that we changed the VirtualHost directive for the virtual server from verbose to wildcard and then specified the server's names and aliai as directives within. Not all directives are required, YMMV. I'm pretty certain that the ones I commented on are the ones that you do need to have.

Now, let's fix up Tomcat and avoidthe Apache http daemon from ignoring our Tomcat virtual because of mismatch. I commented out the original VirtualServer opener and enabled the corrected one.

#<VirtualHost www.my_first_domain.com:443>
<VirtualHost *:443>


Pretty easy. Then I added a ServerName directive within

ServerName www.my_first_domain.com

That will keep Scalix running right.

Now, add the other virtual servers. Note that VirtualHost directive is identical to the default. The next two directives identify our second site for us:

<VirtualHost *:80>
ServerName www.my_second_domain.com
ServerAlias my_second_domain.com *.my_second_domain.com
DocumentRoot /htdocs/my_second_domain
ServerAdmin too.many.hours@my_second_domain.com
ServerSignature email
DirectoryIndex index.html index.php index.htm index.shtml
LogLevel warn
Options Indexes
</VirtualHost>


and so forth and so on with your third, fourth or footh site, with you setting your paths, options and address correctly and nonesuch.

And bounce the httpd daemon however your flavor of Apache does it.

If you get a successul restart, you're golden. If not, fix your typing errors.

Do an httpd -S and take a peek under the VirtualHost hood.

You'll probably note a warning regarding your Tomcat connector on port 443, but with Virtuals it's literally first come, first serve so it will work fine. I'll parse it out of the logs later and then fix the issue, and likely implement a virtual.conf in my Apache configurations directory, but it is after 11pm on Christmas weekend and warnings or no warnings, Scalix is up and fine kludge or no kludge, all of the sites are working fine, this server can go live a few days late but I can go and say hi to my Wife.
8)

(note: I know the directives are hacked to hell, but this was the first go at a fix, and cleanup can wait till Santa's done.)


Return to “Installation”



Who is online

Users browsing this forum: No registered users and 6 guests