nginx points the sub-directory of an alias folder to the base directory

Posted by Starry on Server Fault See other posts from Server Fault or by Starry
Published on 2014-06-07T03:04:57Z Indexed on 2014/06/07 3:29 UTC
Read the original article Hit count: 483

Filed under:
|

I am new to Nginx. Now I have a confusion on nginx configurations:

My web site contains folders in different locations:

location / {
  root /Path1
}

location ^~ /personal {
  alias /Path2
}

When I query http://mysite/personal, I am accessing the content of /Path2 instead of /Path1

Now I want to add a sub-directory in /personal with specific configurations, so I add:

location /personal/download {
  autoindex on;
}

But I got 404 error when querying http://mysite/personal/download. According to the error log, I am directed to /Path1/personal/download, which is not correct. How can I configure nginx, such that all access to http://mysite/personal/* will be directed to the same directory in /Path2?

© Server Fault or respective owner

Related posts about nginx

Related posts about subdirectories