Nginx user subdomains, should I proxy_pass?

Posted by Kevin L. on Server Fault See other posts from Server Fault or by Kevin L.
Published on 2011-03-11T21:32:00Z Indexed on 2011/03/12 0:12 UTC
Read the original article Hit count: 504

I am trying to setup user subdomains, serving content from specific folders: www.example.com/username served from username.example.com (just like github pages).

I've looked at Nginx rewrites, but I don't want the browser to redirect--I want the domain to be username.example.com. Anyway, a comment on this question says that I cannot rewrite host, only proxy to it. I tried to setup a proxy_pass, but all of the documentation and examples show it being used to (obviously) proxy to a service on another host or port, but in my case I want to just proxy to another location on the same host and port.

Is this the appropriate way to tackle this problem, and if so, what is the right Nginx config syntax?

© Server Fault or respective owner

Related posts about nginx

Related posts about subdomain