Rugnar
Rugnar

Reputation: 3122

Nginx static files 403 forbidden

I'm trying to configure nginx to serve static files from a directory. And getting 403 Forbidden when trying to access the path /static/

Here is parts from my config:

user root;
<...>
http {
    <...>
    server {
        <...>
        location /static/
        {
            alias /home/my_user/static/;
            autoindex on;
        }
        <...>
    }
}

I also have permissions 777 recursive for /home/my_user/static/ and yes i have index.html inside the directory. And still getting the error. Why?

os: Centos 7

Upvotes: 0

Views: 2903

Answers (1)

Rugnar
Rugnar

Reputation: 3122

Enabling flag

/usr/sbin/setsebool -P httpd_read_user_content true

Solves the problem.

Thx to https://serverfault.com/questions/899187/nginx-static-file-configuration-for-cenotos-7-minimal-installation

Upvotes: 1

Related Questions