Apache Server configuration support - Need help: Redirection - webserer and mailserver (webmail)

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > March 2005 > Need help: Redirection - webserer and mailserver (webmail)





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Need help: Redirection - webserer and mailserver (webmail)
Robertico

2005-03-22, 6:12 pm

Hi,

I'am running a webserver on FreeBSD and Apache2. I'am also running a
mailserver with Squirrel webmail.
Now i want to redirect http://mail.mydomain.nl to
https://www.mydomain.nl/webmail/login.php.
(www.mydomain.nl is my normal website.)

Undermentioned modifications of my httpd.conf file didn't do the job.

<VirtualHost *:80>
ServerName mail.mydomain.nl
ServerAdmin robertico@mydomain.nl
Documentroot /usr/local/www/data/webmail
Redirect / https://www.mydomain.nl/webmail
</VirtualHost>

Or maybe there is a better solution to redirect mail.mydomain.nl to my
webmail login.php.
Please some advice.

Robertico


Davide Bianchi

2005-03-22, 6:12 pm

On 2005-03-22, Robertico <Robert@nomail.net> wrote:
><VirtualHost *:80>
> ServerName mail.mydomain.nl
> ServerAdmin robertico@mydomain.nl
> Documentroot /usr/local/www/data/webmail
> Redirect / https://www.mydomain.nl/webmail
></VirtualHost>


Well, it's correct (besides the fact that if you have a Redirect / the
DocumentRoot directive doesn't have any sense). What kind of error or
problem do you obtain? Did you restarted the server after the modification?
What apachectl configtest return?

Davide

--
Violence, rude language, excessive drinking,
paganism. It's hard to find children's books like that these
days. --Stig Morten Valstad on alt.sysadmin.recovery
Robertico

2005-03-22, 6:12 pm

> What kind of error or problem do you obtain?
Even www.mydomain.nl redirects to https://www.mydomain.nl/webmail/login.php
and not only mail.mydomain.nl.

> Did you restarted the server after the modification?

Yes

> What apachectl configtest return?

Syntax OK

Robertico


Davide Bianchi

2005-03-22, 6:12 pm

On 2005-03-22, Robertico <Robertico@nomail.net> wrote:
> Even www.mydomain.nl redirects to https://www.mydomain.nl/webmail/login.php
> and not only mail.mydomain.nl.


That make me think that 'mail.mydomain.nl' is the first VirtualHost defined
in your file. When Apache can't understand for sure which VHost you want
he gets the first one in the list.

Now, there are many reasons why Apache could get confused, the first
is because you are connecting trought a proxy that mangle the request,
the second is that you have mixed IP addresses and not-ip-addresses
defined VHost (like NameVirtualHost ip.address.here and then using
* in the Vhost definition).

Davide

--
The day Micro$lop makes something that doesn't suck is probably the
day they start making vacuum cleaners.
--Ernst Jan Plugge
Robertico

2005-03-24, 5:53 pm

> That make me think that 'mail.mydomain.nl' is the first VirtualHost
> defined
> in your file.

I have only one VirtualHost, as defined in my first post.

> Now, there are many reasons why Apache could get confused, the first
> is because you are connecting trought a proxy that mangle the request,

No

I have this also in my httpd.conf:

Alias /webmail "/usr/local/www/data/webmail"

<Directory "/usr/local/www/data/webmail">
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
AllowOverride None
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>

Robertico


Robertico

2005-03-25, 7:57 am

> You need at least two Vhost, one for the 'webmail' and one for the
> 'normal' website.

Yep right, I already tried this using the following:

# Use name-based virtual hosting.
NameVirtualHost 10.0.0.10
#

<VirtualHost www.mydomain.nl:80>
ServerName www.mydomain.nl
ServerAdmin robertico@mydomain.nl
Documentroot /usr/local/www/data/
</VirtualHost>

<VirtualHost mail.mydomain.nl:443>
ServerName mail.mydomain.nl
ServerAdmin robertico@mydomain.nl
Documentroot /usr/local/www/data/webmail
Redirect / https://www.mydomain.nl/webmail
</VirtualHost>

With the following error message:
[error] VirtualHost www.mydomain.nl:80 -- mixing * ports and non-* ports
with a NameVirtualHost address is not supported, proceeding with undefined
results
And without the specified ports it doesn't work.

Robertico


Davide Bianchi

2005-03-25, 7:57 am

On 2005-03-25, Robertico <Robertico@nomail.net> wrote:
> Yep right, I already tried this using the following:
>
> # Use name-based virtual hosting.
> NameVirtualHost 10.0.0.10


Don't use IP. If you use NameVirtualHost (name based) use *.

> <VirtualHost www.mydomain.nl:80>


Ditto. You already specified the server name in the block, so use *:80

> <VirtualHost mail.mydomain.nl:443>


Ditto. And if you use port 443 you need to enable SSL or you'll
receive errors related to the use of HTTP over HTTPS.

Davide

--
To segfault is human; to bluescreen moronic.
-- From a Slashdot.org post
Stefanie

2005-03-25, 7:57 am

I'am stuck ....

Can you write the exact syntax for my VirtualHosts based on my previous
post.
I still received errors from Apache (even when i changed it as you advised).

I have enabled SSL. Linking from www.mydomain.nl to my webmail and log-in is
not a problem.

Robertico


Robertico

2005-03-25, 7:57 am

Sorry, posted with my girlfriends account :-))

Robertico


Davide Bianchi

2005-03-25, 7:57 am

On 2005-03-25, Stefanie <Stefanie@nomail.net> wrote:
> Can you write the exact syntax for my VirtualHosts based on my previous


Something like...

# Use name-based virtual hosting.
NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.mydomain.nl
ServerAdmin robertico@mydomain.nl
Documentroot /usr/local/www/data/
</VirtualHost>

<VirtualHost *:80>
ServerName mail.mydomain.nl
ServerAdmin robertico@mydomain.nl
Redirect / https://www.mydomain.nl/webmail
</VirtualHost>

Note: I removed the 'DocumentRoot' option in the mail.mydomain.nl since
you're redirecting the whole thing to another 'server' (running https).
So you don't need the DocumentRoot directive after all.

Note2: this is based on the idea that SOMEWHERE you are also defining
SSL support and have another <VirtualHost> defined to handle https
on port 443.

Davide
--
Free your software, and your XXX will follow
-- Laurent Szyster
Robertico

2005-03-25, 7:57 am

THANKS....it's functioning...many thanks !

Robertico


Robertico

2005-03-30, 7:57 am

> That make me think that 'mail.mydomain.nl' is the first VirtualHost
> defined
> in your file.

I have only one VirtualHost, as defined in my first post.

> Now, there are many reasons why Apache could get confused, the first
> is because you are connecting trought a proxy that mangle the request,

No

I have this also in my httpd.conf:

Alias /webmail "/usr/local/www/data/webmail"

<Directory "/usr/local/www/data/webmail">
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
AllowOverride None
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>

Robertico


Davide Bianchi

2005-03-30, 7:57 am

On 2005-03-24, Robertico <Robertico@nomail.net> wrote:
> I have only one VirtualHost, as defined in my first post.


Well, if you have only ONE virtualhost, that will be used anytime,
no matter what you require. You need at least two Vhost, one for
the 'webmail' and one for the 'normal' website.

Davide

--
Unix: Where /sbin/init is still Job 1.
-- From a Slashdot.org post
Robertico

2005-03-30, 7:57 am

> You need at least two Vhost, one for the 'webmail' and one for the
> 'normal' website.

Yep right, I already tried this using the following:

# Use name-based virtual hosting.
NameVirtualHost 10.0.0.10
#

<VirtualHost www.mydomain.nl:80>
ServerName www.mydomain.nl
ServerAdmin robertico@mydomain.nl
Documentroot /usr/local/www/data/
</VirtualHost>

<VirtualHost mail.mydomain.nl:443>
ServerName mail.mydomain.nl
ServerAdmin robertico@mydomain.nl
Documentroot /usr/local/www/data/webmail
Redirect / https://www.mydomain.nl/webmail
</VirtualHost>

With the following error message:
[error] VirtualHost www.mydomain.nl:80 -- mixing * ports and non-* ports
with a NameVirtualHost address is not supported, proceeding with undefined
results
And without the specified ports it doesn't work.

Robertico


Davide Bianchi

2005-03-30, 6:02 pm

On 2005-03-25, Robertico <Robertico@nomail.net> wrote:
> Yep right, I already tried this using the following:
>
> # Use name-based virtual hosting.
> NameVirtualHost 10.0.0.10


Don't use IP. If you use NameVirtualHost (name based) use *.

> <VirtualHost www.mydomain.nl:80>


Ditto. You already specified the server name in the block, so use *:80

> <VirtualHost mail.mydomain.nl:443>


Ditto. And if you use port 443 you need to enable SSL or you'll
receive errors related to the use of HTTP over HTTPS.

Davide

--
To segfault is human; to bluescreen moronic.
-- From a Slashdot.org post
Stefanie

2005-03-30, 6:02 pm

I'am stuck ....

Can you write the exact syntax for my VirtualHosts based on my previous
post.
I still received errors from Apache (even when i changed it as you advised).

I have enabled SSL. Linking from www.mydomain.nl to my webmail and log-in is
not a problem.

Robertico


Robertico

2005-03-30, 6:02 pm

Sorry, posted with my girlfriends account :-))

Robertico


Davide Bianchi

2005-03-30, 6:02 pm

On 2005-03-25, Stefanie <Stefanie@nomail.net> wrote:
> Can you write the exact syntax for my VirtualHosts based on my previous


Something like...

# Use name-based virtual hosting.
NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.mydomain.nl
ServerAdmin robertico@mydomain.nl
Documentroot /usr/local/www/data/
</VirtualHost>

<VirtualHost *:80>
ServerName mail.mydomain.nl
ServerAdmin robertico@mydomain.nl
Redirect / https://www.mydomain.nl/webmail
</VirtualHost>

Note: I removed the 'DocumentRoot' option in the mail.mydomain.nl since
you're redirecting the whole thing to another 'server' (running https).
So you don't need the DocumentRoot directive after all.

Note2: this is based on the idea that SOMEWHERE you are also defining
SSL support and have another <VirtualHost> defined to handle https
on port 443.

Davide
--
Free your software, and your XXX will follow
-- Laurent Szyster
Robertico

2005-03-30, 6:02 pm

THANKS....it's functioning...many thanks !

Robertico


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com