Ciao,
I’m setting up several isolated Laravel apps in sub-folders of a single site. Web root
folder
of Laravel is called “public”, and I want to access such installation by
URI
“/app1/”. There are static files, maybe few custom php, and a single
entry
point /index.php
.
So I came up with a config like this:
location ^~ /app1 {
root /var/www/apps.mydomain.com/Laravel_app1/public;
rewrite ^/app1/?(.*)$ /$1 break;
location ~* \.(jpg|gif|png)$ {
try_files $uri =404;
...
}
location ~* !(\.(jpg|gif|png))$ {
proxy_pass http://127.0.0.1:8081;
...
}
}
Two questions:
-
what happens to an “alias” inside a “^~” location like “location ^~
/app1
{ … }” – seems like $uri is not changed and “/abcdef” part remains in
place. -
how can I write a nested default “/” location after a rewrite and a
regexp location? Got [emerg] errors when trying to write it like this:
location ^~ /app1 {
rewrite ^/app1/?(.)$ /$1 break;
location ~ .(jpg|gif|png)$ { …static files instructions… }
location / { proxy_pass …php files and folders go to
Laravel… }
}
Serge.
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,246584,246584#msg-246584