Arthur
Arthur

Reputation: 3473

Nginx - how to correctly define root dir for location?

all.

Plese advice, how to correctly set root dir for location.

Now I have incorrect config:

location ~* ^/upload/ 
{
root /home/site/upload/
}

I want to locate all files from URLs, what are started from /upload/ from directory /home/site/upload/

But Nginx try to locate files from /home/site/upload/upload/ , for example /home/site/upload/upload/1.doc

How to fix my config?

Upvotes: 1

Views: 554

Answers (1)

Arthur
Arthur

Reputation: 3473

Founded solution!

http://nginx.org/ru/docs/http/ngx_http_core_module.html#alias

Result:

location /upload/ 
{
alias /home/site/upload/;
}

Upvotes: 1

Related Questions