Reputation: 15
i'm tring to set up nginx to serve my node.js app static files. The problem is that i recive a 403 Forbidden status when i try to get my files.
server {
listen 80 default_server;
server_name sitename.com;
root /root/appJs/public;
sendfile on;
location /doc {
root /root/appJs/public;
}
}
when i try to download a file from /root/appJs/public/css/style.css i write http://sitename.com/css/style.css i recive 403 Forbidden status. why? i have already look for solutions on some forums but notthing
Upvotes: 0
Views: 787
Reputation: 692
Make sure nginx has permissions to read the directory and files.
Assuming your nginx.conf
has a user www-data;
line, you need to give permissions to user www-data
to that directory:
$ sudo chown -R root:www-data /root/appJs/public
$ sudo chmod o+X /root /root/appJs
$ sudo chmod -R g=rX /root/appJs/public
Upvotes: 2