I have a web app in the folder:
/home/main_user/dir1/dir2/my_web_app/
In there I have an executable file and the folder assets.
Nginx is setup this way - to serve assets only:
location ~ ^/assets/(images|css|js| [.........])/(.*) {
alias /home/main_user/dir1/dir2/my_web_app/assets/$1/$2;
autoindex off;
}
Nginx is running under user "http"
It turns out that nginx has permission denied error for the "assets" folder. Even when I changed the owner of directory "assets" to be "http" and gave it 755
To fix the error I'll have to give permissions "o+x" all the way from the root up to the folder "assets". Not merely to the folder "assets"
Namely, I'll have to call "o+x" for:
/home
/home/main_user/
/home/main_user/dir1/
etc.....
This seems wrong to me, at least because everyone would be permitted to execute any file in /home/main_user. But doing that only for the directory "assets" doesn't work.
Is there a better and, more over, recommended way?