You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Roberto Tortolero <ro...@gmail.com> on 2007/04/27 18:25:12 UTC

[users@httpd] Re: virtualhost via proxy on apache 2.0.40 problem

Hi
I have problem with proxys on apache, i have two servers and i want to use
one as a firewall an the other as web page server. i've all ready doned,
but, the thing is that apache always returned the same carpet all the time,
no matter what address i put, always redirect me to the first virtual host.
what should a do???

In the proxy server i have this on the httpd.conf:

#el vhost para direccionar al otro servidor
<VirtualHost xxx.xxx.xxx.77>
#ProxyPreserveHost on
ProxyPass / http://xxx.xxx.xxx.12/
ProxyPassReverse / http://xxx.xxx.xxx.12/

ServerName www.site1.com
</VirtualHost>

<VirtualHost xxx.xxx.xxx.77>
#ProxyRequests On
#ProxyVia On

#ProxyPreserveHost on
ProxyPass / http://xxx.xxx.xxx.12/
ProxyPassReverse / http://xxx.xxx.xxx.12/

ServerName www.site2.com
</VirtualHost>


and in the other server, the one that contains all the pages, have this
config:

<VirtualHost xxx.xxx.xxx.12>
VirtualDocumentRoot /usr/local/apache2/htdocs/site1/
ServerName www.site1.com
<Directory "/usr/local/apache2/htdocs/site1">
allow from all
Options +Indexes
</Directory>
</VirtualHost>


<VirtualHost xxx.xxx.xxx.12>
VirtualDocumentRoot /usr/local/apache2/htdocs/site2/
ServerName www.site2.com
<Directory "/usr/local/apache2/htdocs/site2">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

and no matter what address i put it always return me the first site on the
second server, that one with the pages, the first viartualhost on the secand
server.

Re: [users@httpd] Re: virtualhost via proxy on apache 2.0.40 problem

Posted by Roberto Tortolero <ro...@gmail.com>.
well, thank you joshua, but aparently, the problem was in on directive in
the second server, the directive is DirectoryIndex wish it come in one
conditional, and it seems that always pass away that directive. Now
everithing, by the moment, is working very well...
And my version of apache works perfectly, right now i don`t need more, but
thanks for the recommendation...

Thanks a lot


On 4/27/07, Joshua Slive <jo...@slive.ca> wrote:
>
> On 4/27/07, Roberto Tortolero <ro...@gmail.com> wrote:
> > Hi
> > I have problem with proxys on apache, i have two servers and i want to
> use
> > one as a firewall an the other as web page server. i've all ready doned,
> > but, the thing is that apache always returned the same carpet all the
> time,
> > no matter what address i put, always redirect me to the first virtual
> host.
> > what should a do???
> >
> > In the proxy server i have this on the httpd.conf:
> >
> > #el vhost para direccionar al otro servidor
> > <VirtualHost xxx.xxx.xxx.77>
> > #ProxyPreserveHost on
> > ProxyPass / http://xxx.xxx.xxx.12/
> > ProxyPassReverse / http://xxx.xxx.xxx.12/
> >
> > ServerName www.site1.com
> > </VirtualHost>
> >
> > <VirtualHost xxx.xxx.xxx.77>
> > #ProxyRequests On
> > #ProxyVia On
> >
> > #ProxyPreserveHost on
> > ProxyPass / http://xxx.xxx.xxx.12/
> > ProxyPassReverse / http://xxx.xxx.xxx.12/
> >
> > ServerName www.site2.com
> > </VirtualHost>
> >
> >
> > and in the other server, the one that contains all the pages, have this
> > config:
> >
> > <VirtualHost xxx.xxx.xxx.12 >
> > VirtualDocumentRoot /usr/local/apache2/htdocs/site1/
> > ServerName www.site1.com
> > <Directory "/usr/local/apache2/htdocs/site1">
> > allow from all
> > Options +Indexes
> > </Directory>
> > </VirtualHost>
> >
> >
> > <VirtualHost xxx.xxx.xxx.12>
> > VirtualDocumentRoot /usr/local/apache2/htdocs/site2/
> > ServerName www.site2.com
> > <Directory "/usr/local/apache2/htdocs/site2">
> > allow from all
> > Options +Indexes
> > </Directory>
> > </VirtualHost>
> >
> > and no matter what address i put it always return me the first site on
> the
> > second server, that one with the pages, the first viartualhost on the
> secand
> > server.
>
> -1. Your apache version is obsolete. You should try something more modern.
>
> 0. Did you read http://httpd.apache.org/docs/2.0/vhosts/name-based.html ?
>
> 1. You need the NameVirtualHost directive in both configs.
>
> 2. You'll need to uncomment those ProxyPreserveHost directives;
> otherwise, the back-end host has no way to differentiate among the
> requests for the two different vhosts.
>
> 3. You want the DocumentRoot directive, not VirtualDocumentRoot.
>
> Joshua.
>
> ---------------------------------------------------------------------
> 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
>
>

Re: [users@httpd] Re: virtualhost via proxy on apache 2.0.40 problem

Posted by Joshua Slive <jo...@slive.ca>.
On 4/27/07, Roberto Tortolero <ro...@gmail.com> wrote:
> Hi
> I have problem with proxys on apache, i have two servers and i want to use
> one as a firewall an the other as web page server. i've all ready doned,
> but, the thing is that apache always returned the same carpet all the time,
> no matter what address i put, always redirect me to the first virtual host.
> what should a do???
>
> In the proxy server i have this on the httpd.conf:
>
> #el vhost para direccionar al otro servidor
> <VirtualHost xxx.xxx.xxx.77>
> #ProxyPreserveHost on
> ProxyPass / http://xxx.xxx.xxx.12/
> ProxyPassReverse / http://xxx.xxx.xxx.12/
>
> ServerName www.site1.com
> </VirtualHost>
>
> <VirtualHost xxx.xxx.xxx.77>
> #ProxyRequests On
> #ProxyVia On
>
> #ProxyPreserveHost on
> ProxyPass / http://xxx.xxx.xxx.12/
> ProxyPassReverse / http://xxx.xxx.xxx.12/
>
> ServerName www.site2.com
> </VirtualHost>
>
>
> and in the other server, the one that contains all the pages, have this
> config:
>
> <VirtualHost xxx.xxx.xxx.12 >
> VirtualDocumentRoot /usr/local/apache2/htdocs/site1/
> ServerName www.site1.com
> <Directory "/usr/local/apache2/htdocs/site1">
> allow from all
> Options +Indexes
> </Directory>
> </VirtualHost>
>
>
> <VirtualHost xxx.xxx.xxx.12>
> VirtualDocumentRoot /usr/local/apache2/htdocs/site2/
> ServerName www.site2.com
> <Directory "/usr/local/apache2/htdocs/site2">
> allow from all
> Options +Indexes
> </Directory>
> </VirtualHost>
>
> and no matter what address i put it always return me the first site on the
> second server, that one with the pages, the first viartualhost on the secand
> server.

-1. Your apache version is obsolete. You should try something more modern.

0. Did you read http://httpd.apache.org/docs/2.0/vhosts/name-based.html ?

1. You need the NameVirtualHost directive in both configs.

2. You'll need to uncomment those ProxyPreserveHost directives;
otherwise, the back-end host has no way to differentiate among the
requests for the two different vhosts.

3. You want the DocumentRoot directive, not VirtualDocumentRoot.

Joshua.

---------------------------------------------------------------------
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