Welcome! Log In Create A New Profile

Advanced

Re: rewrite help

May 05, 2010 11:56AM
On Wed, May 05, 2010 at 10:56:40AM +0000, glen@lumanau.web.id wrote:

> When I open /test/article, it's redirected to index page again

The request may be proxied to nginx itself, to

server {
listen 80;
server_name www.example.com;

Try to set backedn address in
proxy_pass http://www.example.com/site/yahoo/;
instead of www.example.com.

> Best Regards,
>
> Glen Lumanau
>
> -----Original Message-----
> From: Igor Sysoev <igor@sysoev.ru>
> Date: Wed, 5 May 2010 14:50:13
> To: <nginx@nginx.org>
> Subject: Re: rewrite help
>
> On Wed, May 05, 2010 at 10:36:29AM +0000, glen@lumanau.web.id wrote:
>
> > Yes it should be rewrite to
> > http://www.example.com/site/yahoo/test/article
> >
> > Is there any way to do this?
>
> location / {
> proxy_pass http://www.example.com/site/yahoo/;
> }
>
> What error do you see with this configuration ?
>
> > -----Original Message-----
> > From: Igor Sysoev <igor@sysoev.ru>
> > Date: Wed, 5 May 2010 13:56:05
> > To: <nginx@nginx.org>
> > Subject: Re: rewrite help
> >
> > On Wed, May 05, 2010 at 04:50:01PM +0700, Glen Lumanau wrote:
> >
> > > Hi Igor,
> > >
> > > It works already on index. But when i accessing
> > > yahoo.example.com/test/article, it gives me error.
> >
> > Where should it be proxied to ? To
> >
> > http://www.example.com/site/yahoo/test/article
> >
> > ?
> >
> > > When i give proxy_pass http://www.example.com/site/yahoo.com$request_uri, it
> > > giving me bad gateway
> >
> > This is because nginx try dynamically resolve www.example.com without
> > resolver defined.
> >
> > However, this way
> >
> > location / {
> > proxy_pass http://www.example.com/site/yahoo/;
> > }
> >
> > is better than
> >
> > location / {
> > proxy_pass http://www.example.com/site/yahoo/request_uri;
> > }
> >
> > > -----Original Message-----
> > > From: Igor Sysoev [mailto:igor@sysoev.ru]
> > > Sent: 05 Mei 2010 16:06
> > > To: nginx@nginx.org
> > > Subject: Re: rewrite help
> > >
> > > On Wed, May 05, 2010 at 03:22:36PM +0700, Glen Lumanau wrote:
> > >
> > > > I tried
> > > >
> > > > server {
> > > > listen 80;
> > > > server_name yahoo.example.com;
> > > >
> > > > rewrite ^.+ http://www.example.com/site/yahoo$uri last;
> > > > }
> > > >
> > > > However it's not rewrited. It's being redirected to
> > > http://www.example.com/site/yahoo
> > >
> > > server {
> > > server_name yahoo.example.com;
> > > location / {
> > > proxy_pass http://www.example.com/site/yahoo/;
> > > }
> > > }
> > >
> > > server {
> > > server_name google.example.com;
> > > location / {
> > > proxy_pass http://www.example.com/site/google/;
> > > }
> > > }
> > >
> > >
> > > > -----Original Message-----
> > > > From: Edho P Arief [mailto:edhoprima@gmail.com]
> > > > Sent: 05 Mei 2010 15:16
> > > > To: nginx@nginx.org
> > > > Subject: Re: rewrite help
> > > >
> > > > On Wed, May 5, 2010 at 3:09 PM, Glen Lumanau <glen@lumanau.web.id> wrote:
> > > > > Hi folks,
> > > > >
> > > > >
> > > > >
> > > > > I need a rewrite rules like this
> > > > >
> > > > >
> > > > >
> > > > > I have www.example.com, google.example.com, yahoo.example.com
> > > > >
> > > > >
> > > > >
> > > > > I need to rewrite
> > > > >
> > > > > Google.example.com à www.example.com/site/google
> > > > >
> > > > > Yahoo.example.com à www.example.com/site/yahoo
> > > > >
> > > > >
> > > > >
> > > > > How can I do that?
> > > > >
> > > >
> > > > separate server block with rewrite on each blocks
> > > >
> > > >
> > > >
> > > > --
> > > > O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
> > > >
> > > >_______________________________________________
> > > > nginx mailing list
> > > > nginx@nginx.org
> > > > http://nginx.org/mailman/listinfo/nginx
> > > >
> > > >
> > > >_______________________________________________
> > > > nginx mailing list
> > > > nginx@nginx.org
> > > > http://nginx.org/mailman/listinfo/nginx
> > >
> > > --
> > > Igor Sysoev
> > > http://sysoev.ru/en/
> > >
> > >_______________________________________________
> > > nginx mailing list
> > > nginx@nginx.org
> > > http://nginx.org/mailman/listinfo/nginx
> > >
> > >
> > >_______________________________________________
> > > nginx mailing list
> > > nginx@nginx.org
> > > http://nginx.org/mailman/listinfo/nginx
> >
> > --
> > Igor Sysoev
> > http://sysoev.ru/en/
> >
> >_______________________________________________
> > nginx mailing list
> > nginx@nginx.org
> > http://nginx.org/mailman/listinfo/nginx
> >_______________________________________________
> > nginx mailing list
> > nginx@nginx.org
> > http://nginx.org/mailman/listinfo/nginx
>
> --
> Igor Sysoev
> http://sysoev.ru/en/
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx

--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

rewrite help

Glen Lumanau May 05, 2010 04:16AM

Re: rewrite help

edogawaconan May 05, 2010 04:22AM

RE: rewrite help

Glen Lumanau May 05, 2010 04:28AM

Re: rewrite help

edogawaconan May 05, 2010 04:32AM

Re: rewrite help

Ray May 05, 2010 04:36AM

RE: rewrite help

Glen Lumanau May 05, 2010 05:16AM

Re: rewrite help

Ray May 05, 2010 05:34AM

Re: rewrite help

Igor Sysoev May 05, 2010 05:12AM

RE: rewrite help

Glen Lumanau May 05, 2010 05:54AM

Re: rewrite help

Igor Sysoev May 05, 2010 05:58AM

Re: rewrite help

Anonymous User May 05, 2010 06:44AM

Re: rewrite help

Igor Sysoev May 05, 2010 06:54AM

Re: rewrite help

Anonymous User May 05, 2010 07:00AM

Re: rewrite help

Igor Sysoev May 05, 2010 11:56AM

Re: rewrite help

Ray May 05, 2010 04:30AM

Re: Rewrite help

Anoop Alias November 08, 2016 10:00AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 147
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready