ahmed shaaban
ahmed shaaban

Reputation: 1

how to access a directory besides the root using Nginx?

In Nginx, I try to make the uploads directory outside the root in yii2, but it doesn't accessible

    server_name   teracourses.com;
    set $host_path /var/www/html/teracourses;
    root          $host_path/frontend/web;
    location / {
        try_files $uri $uri/ /$yii_bootstrap?$args;
    }

   location /uploads/ {
        alias   /var/www/html/teracourses/uploads/;
    }

Upvotes: 0

Views: 34

Answers (1)

Tural Ali
Tural Ali

Reputation: 23290

Try the following way:

 location /uploads {
        root /var/www/html/teracourses/uploads/;
 }

it should do the job

Upvotes: 1

Related Questions