How to put rewrite rules for multiple plone instances

Igor Sysoev is at rambler-co.ru
Wed Jan 28 13:31:27 MSK 2009


On Wed, Jan 28, 2009 at 03:56:53PM +0530, Vishnu Kumar D R wrote:

> Hi Igor,
> 
> Let me make it to the point
> 
> whats the nginx equivalent for the statement in apache2?
> RewriteRule ^/(.*)
> http://localhost:8080/VirtualHostBase/http/%{HTTP_HOST}:80/$1 [L,P]

location / {
    proxy_pass http://127.0.0.1:8080/VirtualHostBase/http/$host:80$request_uri;
}

> On Thu, Jan 22, 2009 at 11:39 AM, Igor Sysoev <is at rambler-co.ru> wrote:
> 
> > On Thu, Jan 22, 2009 at 10:21:06AM +0530, Vishnu Kumar D R wrote:
> >
> > > Igor,
> > >
> > > On Sat, Jan 17, 2009 at 1:38 PM, Igor Sysoev <is at rambler-co.ru> wrote:
> > >
> > > >
> > > > These rewrite's are internal and invisible for client.
> > > > However, it's better to use just:
> > > >
> > > >          location = / {
> > > >              proxy_pass http://localhost:6081/Kolkata;
> > > >               include /usr/local/nginx/includes/proxy.conf;
> > > >          }
> > > >
> > > >
> > > > --
> > > > Igor Sysoev
> > > > http://sysoev.ru/en/
> > > >
> > > >
> > > I am getting a error when i edited as you had said above
> > >
> > > 2009/01/21 20:38:07 [emerg] 15886#0: "proxy_pass" may not have URI part
> > in
> > > location given by regular expression, or inside named location, or inside
> > > the "if" statement, or inside the "limit_except" block in
> > > /usr/local/nginx/vhosts/server03.conf:9
> > >
> > > The server03.conf exists like this
> > >
> > >         7         location = / {
> > >       8                 if ($host ~* klk\.explocity\.com$) {
> > >       9                         proxy_pass http://localhost:6081/Kolkata
> > ;
> > >      10                         include
> > > /usr/local/nginx/includes/proxy.conf;
> > >      11                 }
> > >
> > > Please advice
> > > Also, i have hosted this klk.explocity.com using the rewrite(.*)
> > > If you have a look at the site, it shows the /Kolkata in all.
> > > Technically speaking, its not an ideal rewrite, right?
> >
> > If you ever try to write
> >
> >     server {
> >        server_name  default.explocity.com klk.explocity.com;
> >
> >        location = / {
> >            if ($host ~* klk\.explocity\.com$ {
> >                ...
> >            }
> >        }
> >    }
> >
> > This means that you should use
> >
> >    server {
> >        server_name  default.explocity.com;
> >
> >        location = / {
> >            ...
> >        }
> >
> >    }
> >
> >    server {
> >        server_name klk.explocity.com;
> >
> >        location = / {
> >            ...
> >        }
> >    }
> >
> > Do not mix server and locations.
> > A request should be routed first by server, then by location.
> >
> >
> > --
> > Igor Sysoev
> > http://sysoev.ru/en/
> >
> >

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





More information about the nginx mailing list