Why does Nginx return a 403 even though all permissions are set properly?

前端 未结 15 2507
逝去的感伤
逝去的感伤 2020-12-12 09:54

I have Nginx setup and displaying the test page properly. If I try to change the root path, I get a 403 Forbidden error, even though all permissions are identical. Additiona

15条回答
  •  [愿得一人]
    2020-12-12 10:09

    First of all you have to run following command to allow nginx to access filesystem

    sudo setsebool -P httpd_read_user_content 1

    You can check if the files or directory with following command:

    ls -Z
    

    If it is still not accessible, you can try changing the SELinux property of the files and folder with following command:

    chcon -Rt httpd_sys_content_t /path/to/www
    

    However, above command cannot apply to files under FUSE or NFS system.

    To enable serving files from FUSE mounts, you can use:

    setsebool httpd_use_fusefs 1
    

    To enable serving files from NFS mounts, you can use:

    setsebool httpd_use_nfs 1
    

提交回复
热议问题