Welcome! Log In Create A New Profile

Advanced

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

January 18, 2014 03:58PM
Ciao,

I'm setting up several isolated <a href="http://laravel.com/" title="PHP framework">Laravel</a> 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:
[code]
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;
...
}
}
[/code]

Two questions:

1. what happens to an "alias" inside a "^~" location like "location ^~ /app1 { ... }" – seems like $uri is not changed and "/abcdef" part remains in place.

2. 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.
Subject Author Posted

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

sergiks January 18, 2014 03:58PM

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

Francis Daly January 18, 2014 08:32PM

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

sergiks January 19, 2014 04:57AM

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

Francis Daly January 19, 2014 06:04AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 60
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready