backend rewrite of subdomains

Eden Li eden at mojiti.com
Thu Dec 20 00:32:43 MSK 2007


You need to use proxy_pass to have nginx funnel the content from
staging.example.com in order for it to appear to be coming from
subdomain.staging.example.com.

proxy_pass variable support was added in 0.6.18

On 12/19/07, Wayne E. Seguin <wayneeseguin at gmail.com> wrote:
>
>
> On Dec 19, 2007 3:59 PM, 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;
> > }
> >
> >
> Thanks for the reply Eden!
>
> This alas does not do the trick.
>
> changing last to permanent semi works except that it rewrites the users url
> which is not the goal.
> So I need something that is transparent to the user. Any more ideas?
>
> Thanks again!
>
>   ~Wayne
>





More information about the nginx mailing list