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

Francis Daly francis at
Sun Jan 19 01:02:57 UTC 2014

On Sat, Jan 18, 2014 at 03:58:22PM -0500, sergiks wrote:

Hi there,

> 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`.

I'm not sure what you're trying do to.

Maybe your question is clear to other people, in which case, perhaps
they'll answer.

If not, could you try again giving examples of "this url should result in
nginx serving this file", and "this url should result in nginx proxying
to this other url", and whatever else you want nginx to do?

> 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 --

Can you describe what you see, and how it differs from what you
expect? (And show the config you use -- there's no "alias" in the sample

(Note that there are some bugs relating to "alias" and "try_files".)

> 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... }
> }

I'm not sure that that combination is possible.

Are you trying to do something different from what


would do?


Francis Daly        francis at

More information about the nginx mailing list