我正在运行 Centos6.4 机器。
Running vagrant up
Vagrant 文件中没有同步文件夹配置就可以了。我可以通过以下方式访问我的主机http://localhost:8080
它显示 Apache 页面。我可以在中创建index.html/var/www/html
文件夹,它也显示得很好。
但是,在 Vagrant 文件中添加以下行后,访问页面会显示403 Forbidden You don't have permission to access / on this server.
错误改为:
config.vm.synced_folder "./source", "/var/www/html", :extra=>"dmode=777,fmode=777"
进入虚拟机,我看到权限设置如下/var/www
:
drwxr-xr-x. 6 root root 4.0K Jul 20 23:15 .
drwxr-xr-x. 18 root root 4.0K Jul 20 23:15 ..
drwxr-xr-x. 2 root root 4.0K May 14 06:12 cgi-bin
drwxr-xr-x. 3 root root 4.0K Jul 20 23:15 error
drwxrwxrwx. 1 vagrant vagrant 102 Jul 21 23:14 html
drwxr-xr-x. 3 root root 4.0K Jul 20 23:18 icons
所以我尝试将 apache 所有权设置为它,
config.vm.synced_folder "./source", "/var/www/html", :owner=>"apache",:group=>"apache",:extra=>"dmode=777,fmode=777"
但这也不起作用。
显然它有完整的读/写权限,我不知道为什么 apache 会抱怨。