nested location, proxy, alias and multiple "/" locations

sergiks nginx-forum at
Sun Jan 19 09:57:27 UTC 2014

>> I'm not sure what you're trying do to.
My bad, I'll explain it in other way. 

There's a web root  /var/www/site/ that responds to
Then there's a Laravel (front controller php framework) installation in
/var/www/Laravel1, and its web root folder is in /var/www/Laravel1/public/ 
(index.php and static files are there)
I want to let that Laravel app to respond to URIs under /app1/: 
(same - but I had problems that the file was downloading as plaintext in my
experiments) (pretty urls)  (static files)

There will be more that one such app sitting under various subfolders of a
single web site.

>> 1. what happens to an "alias" inside a "^~" location like 
>> "location ^~ /app1 { ... }" 
>> – seems like $uri is not changed 
>> and "/abcdef" part remains in place.
> It should do what the docs say --

The docs only says about a simple "location /i/" case
and a regexp case. 
My q is "location ^~ /i/" which seems to skip the replacement as in the
simple case:
location ^~ /app1/ {
alias /var/www/Laravel/public/;
This example passes unchanged "/app1/api/method" to the proxy, instead of

Re. #2 — figured that out, thanks.

Sergei Sokolov.

Posted at Nginx Forum:,246584,246589#msg-246589

More information about the nginx mailing list