When the root of the site points to the vagrant Synchronize directory, why do you always report 403 errors when you visit?

1) I used vagrant+virtualbox to build the development environment on win7, and box used CentOS7 v1803.1.
2) Synchronize directory is configured in vagrantfile (Synchronize function is normal):

config.vm.synced_folder "D:/7_KaiFa/project", "/ usr/www"

3) the root directory of nginx1.12.2,web installed in the virtual machine points to the Synchronize directory in step 2: / usr/www

    server {
        listen       80;
        server_name  test.aa;

        location / {
            root   /usr/www;
            index  index.html index.htm;
        }
    }

4) permissions:

/usr/www :777
/usr/www/123.html :777

5) question:

 test.aa/123.html  403 Forbidden 
:

2018-04-12 11:08:44 [error] 2575 open () "/ usr/www/123.html" failed (13: Permission denied), client: 192.168.33.1, server: test.aa, request: "GET / 123.html HTTP/1.1", host: "192.168.33.10"

)

6) methods that have been tried

a. Point the root directory of the website to a non-vagrant Synchronize directory. If the / usr/wwwroot, access is normal, you will not report a 403 error. Once you point to the vagrant Synchronize directory, you will get a 403 error when you visit it.
b, the problem of reinstalling and installing nginx1.12.2, is still the same.

I hope that friends who have encountered similar problems will give us some advice. what may be the cause? Thank you.


the same problem, but my mapping directory is also a Git repository. If you remap the folder, there will be no problem. I wonder if there is something wrong with Git and the mapping folder.


because centos enables the SELinux function by default, you can try setenforce 0 and then restart nginx

.
Menu