You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Melanie Pfefer <me...@yahoo.co.uk> on 2008/09/16 12:48:49 UTC

[users@httpd] rewrite rules

hi,

I have 3 instances of apache each running on a separate port.

I have created a 4th instance on port 80 and 3 aliases so that when users want to access let’s say:

http://alias1 it goes to http://server:port1
http://alias2 it goes to http://server:port2
http://alias3 it goes to http://server:port3


http://server and http://alias1 and http://alias2 and http://alias3 refer to the 4th instance (port 80). I want to add rewrite rules so that it redirects to the corresponding apache instance.

I tried to edit httpd.conf of the 4th instance:

RewriteEngine On
ProxyPass /alias1/ http://alias1:5001/
ProxyPassReverse /alias1/ http://alias1:5001/


But http://alias1 still refers to http://alias1 whereas it should go to http://alias1:5001.

Any idea?

thank you


      

---------------------------------------------------------------------
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] rewrite rules

Posted by Vinay Purohit <Vi...@trianz.com>.
Please remove/ unsubscribe me from this email group. I have sent so many
emails :-(

-----Original Message-----
From: Melanie Pfefer [mailto:melanie_pfefer@yahoo.co.uk] 
Sent: Tuesday, September 16, 2008 5:38 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] rewrite rules

Hi Davide,

I followed your example and specified localhost in the VirtualHost
directive. it worked.

one more question please: for the other servers, I tried:

NameVirtualHost *:80

<VirtualHost *:80>
        ServerName alias1
        ProxyPass / http://localhost:5001/
        ProxyPassReverse / http://localhost:5001/ </VirtualHost>

<VirtualHost *:80>
        ServerName alias2
        ProxyPass / http://localhost:5002/
        ProxyPassReverse / http://localhost:5002/

</VirtualHost>


however, http://alias2 goes to http://localhost:5001.

could you please advise?

--- On Tue, 16/9/08, Davide Bianchi <da...@onlyforfun.net> wrote:

> From: Davide Bianchi <da...@onlyforfun.net>
> Subject: Re: [users@httpd] rewrite rules
> To: users@httpd.apache.org
> Date: Tuesday, 16 September, 2008, 2:38 PM Melanie Pfefer wrote:
> > hi Davide,
> > 
> > both apache instances have the basic configuration.
> They have
> different port numbers: the main apache is on port 80 and the other 3 
> instances on 5001, 6001 and 7001.
> > 
> > In the main apache (port 80), I added as you
> suggested:
> > 
> > NameVirtualHost *:80
> > 
> > <VirtualHost *:80>
> >         ServerName alias1
> >         ProxyPass / http://alias1:5001
> >         ProxyPassReverse / http://alias1:5001 </VirtualHost>
> > 
> > but still http://alias1 goes to port 80 while I expect
> it to go to port 5001.
> 
> Hummm.. not sure if I understand what you mean with 'goes to port 
> 80'...
> 
> This is what I just did:
> 
> <VirtualHost *:80>
>         ServerName      cups
>         ProxyPass       /       http://localhost:631/
>         ProxyPassReverse        /      
> http://localhost:631/
> </VirtualHost>
> 
> (cups runs on port 631 on my system) and I can get cups' interface by 
> using http://cups/. Of course, this goes to port 80 on my system and 
> is then 'proxied' to port 631.
> 
> What you mean with "goes to port 80" ? What sort of result you get in 
> your browser? What remains in your error_log or access_log ?
> 
> Davide
> 
> --
> USER, n.: The word computer professionals use when they mean "idiot."
> --Dave Barry, "Claw Your Way to the Top"
> 
> ---------------------------------------------------------------------
> 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


---------------------------------------------------------------------
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] rewrite rules

Posted by Melanie Pfefer <me...@yahoo.co.uk>.
thank you. it worked after clearing the cache


--- On Tue, 16/9/08, Davide Bianchi <da...@onlyforfun.net> wrote:

> From: Davide Bianchi <da...@onlyforfun.net>
> Subject: Re: [users@httpd] rewrite rules
> To: users@httpd.apache.org
> Date: Tuesday, 16 September, 2008, 3:13 PM
> Melanie Pfefer wrote:
> > Hi Davide,
> > 
> > I followed your example and specified localhost in the
> VirtualHost directive. it worked.
> 
> Ah, good.
> 
> > one more question please: for the other servers, I
> tried:
> > 
> > NameVirtualHost *:80
> > 
> > <VirtualHost *:80>
> >         ServerName alias1
> >         ProxyPass / http://localhost:5001/
> >         ProxyPassReverse / http://localhost:5001/
> > </VirtualHost>
> > 
> > <VirtualHost *:80>
> >         ServerName alias2
> >         ProxyPass / http://localhost:5002/
> >         ProxyPassReverse / http://localhost:5002/
> > 
> > </VirtualHost>
> > 
> > however, http://alias2 goes to http://localhost:5001.
> > 
> > could you please advise?
> 
> You did restarted your 'main' apache instance after
> changing the .conf
> file and did cleaned up the cache of your browser, yes?
> 
> Davide
> 
> -- 
> Move along, move along, nothing to see here, definitely no
> evil mind
> control software here, move along, move along...
> --Thorf
> 
> ---------------------------------------------------------------------
> 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


Re: [users@httpd] rewrite rules

Posted by Davide Bianchi <da...@onlyforfun.net>.
Melanie Pfefer wrote:
> Hi Davide,
> 
> I followed your example and specified localhost in the VirtualHost directive. it worked.

Ah, good.

> one more question please: for the other servers, I tried:
> 
> NameVirtualHost *:80
> 
> <VirtualHost *:80>
>         ServerName alias1
>         ProxyPass / http://localhost:5001/
>         ProxyPassReverse / http://localhost:5001/
> </VirtualHost>
> 
> <VirtualHost *:80>
>         ServerName alias2
>         ProxyPass / http://localhost:5002/
>         ProxyPassReverse / http://localhost:5002/
> 
> </VirtualHost>
> 
> however, http://alias2 goes to http://localhost:5001.
> 
> could you please advise?

You did restarted your 'main' apache instance after changing the .conf
file and did cleaned up the cache of your browser, yes?

Davide

-- 
Move along, move along, nothing to see here, definitely no evil mind
control software here, move along, move along...
--Thorf

---------------------------------------------------------------------
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] rewrite rules

Posted by Melanie Pfefer <me...@yahoo.co.uk>.
Hi Davide,

I followed your example and specified localhost in the VirtualHost directive. it worked.

one more question please: for the other servers, I tried:

NameVirtualHost *:80

<VirtualHost *:80>
        ServerName alias1
        ProxyPass / http://localhost:5001/
        ProxyPassReverse / http://localhost:5001/
</VirtualHost>

<VirtualHost *:80>
        ServerName alias2
        ProxyPass / http://localhost:5002/
        ProxyPassReverse / http://localhost:5002/

</VirtualHost>


however, http://alias2 goes to http://localhost:5001.

could you please advise?

--- On Tue, 16/9/08, Davide Bianchi <da...@onlyforfun.net> wrote:

> From: Davide Bianchi <da...@onlyforfun.net>
> Subject: Re: [users@httpd] rewrite rules
> To: users@httpd.apache.org
> Date: Tuesday, 16 September, 2008, 2:38 PM
> Melanie Pfefer wrote:
> > hi Davide,
> > 
> > both apache instances have the basic configuration.
> They have
> different port numbers: the main apache is on port 80 and
> the other 3
> instances on 5001, 6001 and 7001.
> > 
> > In the main apache (port 80), I added as you
> suggested:
> > 
> > NameVirtualHost *:80
> > 
> > <VirtualHost *:80>
> >         ServerName alias1
> >         ProxyPass / http://alias1:5001
> >         ProxyPassReverse / http://alias1:5001
> > </VirtualHost>
> > 
> > but still http://alias1 goes to port 80 while I expect
> it to go to port 5001.
> 
> Hummm.. not sure if I understand what you mean with
> 'goes to port 80'...
> 
> This is what I just did:
> 
> <VirtualHost *:80>
>         ServerName      cups
>         ProxyPass       /       http://localhost:631/
>         ProxyPassReverse        /      
> http://localhost:631/
> </VirtualHost>
> 
> (cups runs on port 631 on my system) and I can get
> cups' interface by
> using http://cups/. Of course, this goes to port 80 on my
> system and is
> then 'proxied' to port 631.
> 
> What you mean with "goes to port 80" ? What sort
> of result you get in
> your browser? What remains in your error_log or access_log
> ?
> 
> Davide
> 
> -- 
> USER, n.: The word computer professionals use when they
> mean "idiot."
> --Dave Barry, "Claw Your Way to the Top"
> 
> ---------------------------------------------------------------------
> 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


Re: [users@httpd] rewrite rules

Posted by Davide Bianchi <da...@onlyforfun.net>.
Melanie Pfefer wrote:
> hi Davide,
> 
> both apache instances have the basic configuration. They have
different port numbers: the main apache is on port 80 and the other 3
instances on 5001, 6001 and 7001.
> 
> In the main apache (port 80), I added as you suggested:
> 
> NameVirtualHost *:80
> 
> <VirtualHost *:80>
>         ServerName alias1
>         ProxyPass / http://alias1:5001
>         ProxyPassReverse / http://alias1:5001
> </VirtualHost>
> 
> but still http://alias1 goes to port 80 while I expect it to go to port 5001.

Hummm.. not sure if I understand what you mean with 'goes to port 80'...

This is what I just did:

<VirtualHost *:80>
        ServerName      cups
        ProxyPass       /       http://localhost:631/
        ProxyPassReverse        /       http://localhost:631/
</VirtualHost>

(cups runs on port 631 on my system) and I can get cups' interface by
using http://cups/. Of course, this goes to port 80 on my system and is
then 'proxied' to port 631.

What you mean with "goes to port 80" ? What sort of result you get in
your browser? What remains in your error_log or access_log ?

Davide

-- 
USER, n.: The word computer professionals use when they mean "idiot."
--Dave Barry, "Claw Your Way to the Top"

---------------------------------------------------------------------
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] rewrite rules

Posted by Melanie Pfefer <me...@yahoo.co.uk>.
hi Davide,

both apache instances have the basic configuration. They have different port numbers: the main apache is on port 80 and the other 3 instances on 5001, 6001 and 7001.

In the main apache (port 80), I added as you suggested:

NameVirtualHost *:80

<VirtualHost *:80>
        ServerName alias1
        ProxyPass / http://alias1:5001
        ProxyPassReverse / http://alias1:5001
</VirtualHost>

but still http://alias1 goes to port 80 while I expect it to go to port 5001.

If you insist on the full config files, I will send it to you.

thank you.






--- On Tue, 16/9/08, Davide Bianchi <da...@onlyforfun.net> wrote:

> From: Davide Bianchi <da...@onlyforfun.net>
> Subject: Re: [users@httpd] rewrite rules
> To: users@httpd.apache.org
> Date: Tuesday, 16 September, 2008, 2:18 PM
> Melanie Pfefer wrote:
> > Hi
> > 
> > the DNS already has this alias.
> > server = alias1 = alias2 = alias3
> > this is why http://alias1 = http://server
> > while I want : http://alias1 = http://server:5001
> (that is another apache on this machine)
> 
> Yes, the last part is done by the VHosts, post your
> configuration file.
> 
> Davide
> 
> -- 
> A distributed system is one in which the failure of a
> computer you
> didn't even know existed can render your own computer
> unusable.
> -- Leslie Lamport
> 
> ---------------------------------------------------------------------
> 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


Re: [users@httpd] rewrite rules

Posted by Davide Bianchi <da...@onlyforfun.net>.
Melanie Pfefer wrote:
> Hi
> 
> the DNS already has this alias.
> server = alias1 = alias2 = alias3
> this is why http://alias1 = http://server
> while I want : http://alias1 = http://server:5001 (that is another apache on this machine)

Yes, the last part is done by the VHosts, post your configuration file.

Davide

-- 
A distributed system is one in which the failure of a computer you
didn't even know existed can render your own computer unusable.
-- Leslie Lamport

---------------------------------------------------------------------
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] rewrite rules

Posted by Melanie Pfefer <me...@yahoo.co.uk>.
Hi

the DNS already has this alias.

server = alias1 = alias2 = alias3

this is why http://alias1 = http://server

while I want : http://alias1 = http://server:5001 (that is another apache on this machine)

thanks


--- On Tue, 16/9/08, Davide Bianchi <da...@onlyforfun.net> wrote:

> From: Davide Bianchi <da...@onlyforfun.net>
> Subject: Re: [users@httpd] rewrite rules
> To: users@httpd.apache.org
> Date: Tuesday, 16 September, 2008, 2:07 PM
> Melanie Pfefer wrote:
> > Hi
> > 
> > I am not using virtualhosts because I need to restart
> each instance independently.
> 
> Ah, ok. That make sense.
> 
> > How to proceed? I tried the Virtualhost directive but
> http://alias1 does not redirect to http://alias1:5001
> 
> Well, you need to have somewhere a DNS (or an hosts file in
> your client)
> that can 'resolve' http://alias1 to the IP of your
> machine.
> 
> Davide
> 
> -- 
> The box said "Requires Windows 95 or better."  I
> can't understand
> why it won't work on my Linux computer.
> 
> ---------------------------------------------------------------------
> 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


Re: [users@httpd] rewrite rules

Posted by Davide Bianchi <da...@onlyforfun.net>.
Melanie Pfefer wrote:
> Hi
> 
> I am not using virtualhosts because I need to restart each instance independently.

Ah, ok. That make sense.

> How to proceed? I tried the Virtualhost directive but http://alias1 does not redirect to http://alias1:5001

Well, you need to have somewhere a DNS (or an hosts file in your client)
that can 'resolve' http://alias1 to the IP of your machine.

Davide

-- 
The box said "Requires Windows 95 or better."  I can't understand
why it won't work on my Linux computer.

---------------------------------------------------------------------
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] rewrite rules

Posted by Melanie Pfefer <me...@yahoo.co.uk>.
Hi

I am not using virtualhosts because I need to restart each instance independently.

I am using a separate httpd.conf for each instance.


How to proceed? I tried the Virtualhost directive but http://alias1 does not redirect to http://alias1:5001 

thank you


--- On Tue, 16/9/08, Davide Bianchi <da...@onlyforfun.net> wrote:

> From: Davide Bianchi <da...@onlyforfun.net>
> Subject: Re: [users@httpd] rewrite rules
> To: users@httpd.apache.org
> Date: Tuesday, 16 September, 2008, 1:52 PM
> Melanie Pfefer wrote:
> > hi,
> > 
> > I have 3 instances of apache each running on a
> separate port.
> > I have created a 4th instance on port 80 and 3 aliases
> so that when users want to access let’s say:
> > 
> > http://alias1 it goes to http://server:port1
> > http://alias2 it goes to http://server:port2
> > http://alias3 it goes to http://server:port3
> > 
> > http://server and http://alias1 and http://alias2 and
> http://alias3 refer to the 4th instance (port 80). I want to
> add rewrite rules so that it redirects to the corresponding
> apache instance.
> > 
> > I tried to edit httpd.conf of the 4th instance:
> > 
> > RewriteEngine On
> > ProxyPass /alias1/ http://alias1:5001/
> > ProxyPassReverse /alias1/ http://alias1:5001/
> > 
> > 
> > But http://alias1 still refers to http://alias1
> whereas it should go to http://alias1:5001.
> 
> That's not the way ProxyPass works, what you need is
> VHosts. And BTW,
> why did you created 3 instances instead of one instance
> with 3 VHosts
> since the beginning?
> 
> NameVirtualHost *:80
> 
> <VirtualHost *:80>
> 	ServerName alias1
> 	ProxyPass / http://localhost:port1
> 	ProxyPassReverse / http://localhost:port1
> </VirtualHost>
> 
> repeat for all the 'aliases'
> 
> Davide
> 
> -- 
> I used to be interested in Windows NT, but the more I see
> of it the more
> it looks like traditional Windows with a stabler kernel. I
> don't find
> anything technically interesting there. In my opinion MS is
> a lot better
> at making money than it is at making good operating
> systems.
>    -- Linus Torvalds
> 
> ---------------------------------------------------------------------
> 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


Re: [users@httpd] rewrite rules

Posted by Davide Bianchi <da...@onlyforfun.net>.
Melanie Pfefer wrote:
> hi,
> 
> I have 3 instances of apache each running on a separate port.
> I have created a 4th instance on port 80 and 3 aliases so that when users want to access let’s say:
> 
> http://alias1 it goes to http://server:port1
> http://alias2 it goes to http://server:port2
> http://alias3 it goes to http://server:port3
> 
> http://server and http://alias1 and http://alias2 and http://alias3 refer to the 4th instance (port 80). I want to add rewrite rules so that it redirects to the corresponding apache instance.
> 
> I tried to edit httpd.conf of the 4th instance:
> 
> RewriteEngine On
> ProxyPass /alias1/ http://alias1:5001/
> ProxyPassReverse /alias1/ http://alias1:5001/
> 
> 
> But http://alias1 still refers to http://alias1 whereas it should go to http://alias1:5001.

That's not the way ProxyPass works, what you need is VHosts. And BTW,
why did you created 3 instances instead of one instance with 3 VHosts
since the beginning?

NameVirtualHost *:80

<VirtualHost *:80>
	ServerName alias1
	ProxyPass / http://localhost:port1
	ProxyPassReverse / http://localhost:port1
</VirtualHost>

repeat for all the 'aliases'

Davide

-- 
I used to be interested in Windows NT, but the more I see of it the more
it looks like traditional Windows with a stabler kernel. I don't find
anything technically interesting there. In my opinion MS is a lot better
at making money than it is at making good operating systems.
   -- Linus Torvalds

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