backend rewrite of subdomains
Eden Li
eden at mojiti.com
Thu Dec 20 00:02:39 MSK 2007
Er, sorry that won't work. It's probably remedied, however, if you
shove the last http://* string into a proxy_pass statement and make
sure you use a newer version of 0.6.x so that you can use variables in
the proxy_pass.
eg.
proxy_pass http://staging.example.com/$subdomain;
On 12/19/07, Eden Li <eden at mojiti.com> wrote:
> server {
> # no server_name statement
>
> set $subdomain "index.html";
> if ($http_host ~ "^(.+?)\.") {
> set $subdomain $1;
> }
>
> rewrite ^/(.*) http://staging.example.com/$subdomain/$1 last;
> }
>
> probably works. Note that "_" isn't a valid domain character.
>
> On 12/19/07, Wayne E. Seguin <wayneeseguin at gmail.com> wrote:
> > Igor,
> >
> > I've searched the mailing lists and read the docs and played around with the
> > server but can't quite come up with what I'm trying to do.
> >
> > I am trying to configure
> >
> > *.staging.example.com proxy to backend staging.example.com/*
> >
> > so for example:
> >
> > hi_mom.staging.example.com in the backend goes to
> > staging.example.com/hi_mom/. ..
> >
> > but the clients do not see the rewrite, eg they stay on
> > hi_mom.staging.example.com
> >
> > Is there a way to do this with Nginx?
> >
> > The only thing I've found that is close is :
> > http://pastie.textmate.org/private/7oox7dwjlejheocxufg
> >
> > Thanks,
> >
> > ~Wayne
> >
> >
>
More information about the nginx
mailing list