How to put rewrite rules for multiple plone instances

Igor Sysoev is at rambler-co.ru
Thu Jan 22 09:09:41 MSK 2009


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:
> 
> > On Sat, Jan 17, 2009 at 12:02:42PM +0530, Vishnu Kumar D R wrote:
> >
> > > Thank you very much Igor,
> > > I have gained some expertise in Nginx :)
> > >
> > > Also, How do we make rewrite invisible to viewers, cause the rewrite is
> > > visible for every link in the site klk.example.com.
> >
> > 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/





More information about the nginx mailing list