如何在vagrant中使用nfs配置同步文件夹

时间:2017-09-13 18:12:32

标签: configuration vagrant

config.vm.synced_folder configuration["projects-folder"],
    "/var/www/projects", create: true, group: "www-data",
    owner: "www-data", :mount_options => ["dmode=777","fmode=666"]

config.vm.synced_folder "./localhost", "/var/www/localhost",
    create: true, group: "www-data", owner: "www-data",
    :mount_options => ["dmode=777","fmode=666"]

我的配置文件如上所示。如果我想为这些文件夹使用nfs,我会在mount选项中执行此操作吗?只需在mount选项中添加nfs = true吗?

1 个答案:

答案 0 :(得分:1)

您需要将类型设置为nfs - 请参阅https://www.vagrantup.com/docs/synced-folders/nfs.html#enabling-nfs-synced-folders

config.vm.synced_folder "./localhost", "/var/www/localhost", type: "nfs"
    create: true, group: "www-data", owner: "www-data",
    :mount_options => ["dmode=777","fmode=666"]