Converting subdomain to path component without redirect ?

Francis Daly francis at daoine.org
Sun May 5 08:16:31 UTC 2013


On Sun, May 05, 2013 at 02:38:17AM +0100, henrique matias wrote:

Hi there,

> Also i tried adding the address to the try_files:
> 
> try_files $uri $uri @app/de/; and try_files $uri $uri @app/de;
> 
> but that didn't work either.

Unless you also added new named locations like "@app/de/", I'd expect
that to return HTTP 500.

That's a more specific problem report than "didn't work".

> The core basic of my problem is  "Rewrite the URL based on the "server
> name"".
> 
> So far the only options i see on nginx are:
> 
> 1. Have a configuration with one "if" and one "rewrite" in order to map
> server name to path

http://nginx.org/r/map

Set a (possibly empty) variable called (say) $path_prefix, and then use
that in your rewrite or proxy_pass line.

Note that using a variable in proxy_pass has other requirements too:

http://nginx.org/r/proxy_pass

> 2. Multiple server declarations sharing the same configuration ( probably
> using some sort of include? )

Can work, if the shared configuration is truly the same.

> What you reckon? Any suggestion ?

I still think that until you demonstrate that your back-end works with
this, the rest is not useful.

Test one thing at a time, and keep the configuration simple.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list