httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cameron Beattie" <kj...@orcon.net.nz>
Subject Re: [users@httpd] RewriteRule question: forward requests from one Apache server to another
Date Tue, 28 Jun 2005 08:14:30 GMT
Ok so I checked httpd.conf on server 1 and I stupidly hadn't included 
RewriteEngine On. I've done that and now I get served up a site from server 
2, but it's the wrong site.

I have two virtual hosts set up as follows:

Server 1
NameVirtualHost *:80

<VirtualHost *:80>
        ServerName server.mydomain.com
        RewriteEngine On
        RewriteRule ^/(.*) http://60.234.nnn.nn:8008/$1 [L,P]
</VirtualHost>
<VirtualHost *:80>
        ServerName otherserver.mydomain.com
        RewriteEngine On
        RewriteRule ^/(.*) http://60.234.nnn.nn:8008/$1 [L,P]
</VirtualHost>

Server2
NameVirtualHost *:8008

<VirtualHost *:8008>
        ServerName server.mydomain.com
        DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost *:8008>
        ServerName otherserver.mydomain.com
        DocumentRoot /var/www/html2
</VirtualHost>

When I browse to http://otherserver.mydomain.com I get served up the 
http://server.mydomain.com site. This is the same site that I get served if 
I browse to http://serveripaddress:8080. So I don't think the host header is 
being passed properly from server 1 to server 2.

Any suggestions?

Regards

Cameron

----- Original Message ----- 
From: "Boyle Owen" <Owen.Boyle@swx.com>
To: <users@httpd.apache.org>
Sent: Tuesday, June 28, 2005 6:58 PM
Subject: RE: [users@httpd] RewriteRule question: forward requests from one 
Apache server to another


> -----Original Message-----
> From: Cameron Beattie [mailto:kjcsb@orcon.net.nz]
> Sent: Dienstag, 28. Juni 2005 04:50
> To: users@httpd.apache.org
> Subject: [users@httpd] RewriteRule question: forward requests from one
> Apache server to another
>
>
> I am trying to set up the following configuration:
> 1. Apache server with public IP address
> 2. Apache server behind NAT with no public IP address
> 3. Router with public IP address with port forwarding set up
> for port 8008
> to Apache server 2
> 4. Public DNS record server.mydomain.com resolves to IP
> address of server 1
>
> When a user browses to server.mydomain.com I want a web site
> to be served up
> from from server 2.
>
> I have set the following up in httpd.conf on server 1:
> <VirtualHost *:80>
>         ServerName server.mydomain.com
>         RewriteEngine On
>         RewriteRule ^/(.*) http://60.234.nnn.nn:8008/$1 [L,P]
> </VirtualHost>
>
> I have set the following up in httpd.conf on server 2:
> <VirtualHost *:8008>
>     ServerName server.mydomain.com
>     DocumentRoot /var/www/html
> </VirtualHost>
>
> I can access the website locally by accessing the site on
> server 2, but not
> through server 1. If I enter http://server.mydomain.com I
> just get the
> default apache homepage, rather than the index.phtml page
> that I want to be
> served up. If I enter  http://server.mydomain.com/index.phtml
> I get a 404
> error.

I guess you left the usual doc-root pointing to htdocs in the main part of 
the config (outside the VH).
So if you get the default page then it's not the RewriteRule - the request 
is not getting into the VH container.

Did you do:

NameVirtualHost *:80

to tell apache to use name-based virtual-hosting?

Before worrying about rewriting, get the VH working: comment out the Rewrite 
rules, stick a temporary docroot in the VH container and check you can hit 
it.

Rgds,
Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored.

>
> I guess my rewriterule is wrong but I'm not sure how to fix
> it. Any help
> would be appreciated.
>
> Regards
>
> Cameron
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP
> Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
Diese E-mail ist eine private und persönliche Kommunikation. Sie hat keinen 
Bezug zur Börsen- bzw. Geschäftstätigkeit der SWX Gruppe. This e-mail is of 
a private and personal nature. It is not related to the exchange or business 
activities of the SWX Group. Le présent e-mail est un message privé et 
personnel, sans rapport avec l'activité boursière du Groupe SWX.


This message is for the named person's use only. It may contain 
confidential, proprietary or legally privileged information. No 
confidentiality or privilege is waived or lost by any mistransmission. If 
you receive this message in error, please notify the sender urgently and 
then immediately delete the message and any copies of it from your system. 
Please also immediately destroy any hardcopies of the message. You must not, 
directly or indirectly, use, disclose, distribute, print, or copy any part 
of this message if you are not the intended recipient. The sender's company 
reserves the right to monitor all e-mail communications through their 
networks. Any views expressed in this message are those of the individual 
sender, except where the message states otherwise and the sender is 
authorised to state them to be the views of the sender's company.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message