简体   繁体   中英

Vagrant synced_folder NFS permissions problems on Linux

I'm very tired of trying and read about the correct config for Vagrant synced_folder with NFS on CentOS 7 as guest and Elementary OS Luna as host, I can't do to work nginx with a shared folder.

My config is this:

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"]

I tried too

config.vm.synced_folder "/opt/lampp/htdocs", "/usr/share/nginx/html",
    owner: "nginx",
    group: "nginx",
    mount_options: ["dmode=755,fmode=644"]

And

config.vm.synced_folder "/opt/lampp/htdocs", "/usr/share/nginx/html",
    :nfs => true

And the command ls in the guest machine

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

I've also changed the nginx user name to vagrant. In each change I've been us vagrant reload command.

Inside of /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"

Well, after a few days I solve it with rsync:

config.vm.synced_folder ".", "/usr/share/nginx/html", **type: "rsync"**

http://ryansechrest.com/2014/04/unable-set-permissions-within-shared-folder-using-vagrant-virtualbox/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM