Virtual Directory counterpart in nginx

PHPst picture PHPst · Feb 7, 2014 · Viewed 12.9k times · Source

It seems nginx does not support embeded location bloks. Does this mean there is no VirtualDirectory counterpart in nginx?

What is nginx conf of following Apache conf:

Alias /foo "D:\www\foo\public"
<Directory "D:\www\foo\public">
     # some settings
</Directory>
Alias /bar "D:\www\bar\public"
<Directory "D:\www\bar\public">
     # some other config
</Directory>

Answer

Tan Hong Tat picture Tan Hong Tat · Feb 7, 2014

It would be:

location /foo/ {
    alias d:/www/foo/public/;
}
location /bar/ {
    alias d:/www/bar/public/;
}

Note that there is a longstanding bug that alias and try_files don't work together.