我很厌倦尝试和读取有关Vagrant synced_folder的正确配置,其中使用CentOS 7上的NFS作为访客,而Elementary OS Luna作为主机,我无法使用共享文件夹来处理nginx。
我的配置是:
Vagrantfile
config.vm.network "private_network", ip: "192.168.0.5"
config.vm.synced_folder "/opt/lampp/htdocs", "/usr/share/nginx/html",
owner: "vagrant",
group: "nginx",
mount_options: ["dmode=755,fmode=644"]
我也试过了
config.vm.synced_folder "/opt/lampp/htdocs", "/usr/share/nginx/html",
owner: "nginx",
group: "nginx",
mount_options: ["dmode=755,fmode=644"]
和
config.vm.synced_folder "/opt/lampp/htdocs", "/usr/share/nginx/html",
:nfs => true
并且客户机中的命令
drwxrwxr-x. 1 vagrant nginx 4096 ene 1 21:41 .
drwxr-xr-x. 3 nginx nginx 17 ene 1 17:57 ..
-rw-rw-r--. 1 vagrant nginx 537 sep 16 09:56 50x.html
-rw-rw-r--. 1 vagrant nginx 537 sep 16 09:56 index.html
drwxrwxr-x. 1 vagrant nginx 4096 ene 1 22:13 test
我还将nginx用户名更改为vagrant。在每次改变中,我都是流浪者重装命令。
在/var/log/nginx/error.log中
2015/01/01 22:25:01 [error] 1009#0: *1 "/usr/share/nginx/html/index.html" is forbidden (13: Permission denied), client: 192.168.0.1, server: localhost, request: "GET / HTTP/1.1", host: "192.168.0.5"
答案 0 :(得分:-2)
好吧,几天后我用rsync解决了这个问题:
config.vm.synced_folder ".", "/usr/share/nginx/html", **type: "rsync"**