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

sergiks nginx-forum at nginx.us
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 http://www.site.com
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/:
http://www.site.com/app1/
http://www.site.com/app1/index.php 
(same - but I had problems that the file was downloading as plaintext in my
experiments)
http://www.site.com/app1/api/method (pretty urls)
http://www.site.com/app1/css/bootstram.min.css  (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 -- http://nginx.org/r/alias

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/;
proxy_pass http://127.0.0.1:8081;
This example passes unchanged "/app1/api/method" to the proxy, instead of
"/api/method"

Re. #2 — figured that out, thanks.


Sergei Sokolov.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,246584,246589#msg-246589



More information about the nginx mailing list