指定了Winnfsd错误的挂载选项

时间:2017-10-03 08:26:06

标签: wordpress vagrant virtualbox

我正在使用Vagrant box" vccw-team / xenial64"开发一个WordPress网站,可以在vccw.cc找到。网站很慢,等待时间平均约为5秒,做了一些谷歌搜索,很多人指着Vagrants同步文件夹,与Virtualbox结合很慢。解决方案:nfs。 Nfs在Windows上不存在,因此产生了Vagrant插件winnfsd。

我安装了插件并更改了Vagrantfile:

  config.vm.network :private_network, ip: "192.168.33.10"

  config.vm.synced_folder _conf['synced_folder'],
      _conf['document_root'], :create => "true", :mount_options => ['dmode=755', 'fmode=644'], type: "nfs"

关于流浪者,我收到此消息:

==> vccw.dev: Mounting NFS shared folders...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3,udp,dmode=755,fmode=644 192.168.33.1:/D/_projects/Vagrant/vccw/wordpress /var/www/html

Stdout from the command:



Stderr from the command:

mount.nfs: an incorrect mount option was specified

我想部分192.168.33.1:/D/_projects/Vagrant/vccw/wordpress可能是错误的,因为D / _projects / Vagrant / vccw / wordpress存在于主机上而不存在于guest虚拟机上(192.168.33.1)。 / p>

其他人设法让插件正常运行。有谁知道我做错了什么?

版本:

  • Vagrant:2.0.0
  • vagrant-winnfsd:1.3.1
  • Virtualbox:5.1.26 r117224(Qt5.6.2)

1 个答案:

答案 0 :(得分:0)

我在Vagrantfile中启用了DHCP,如下所示:

  config.vm.network :private_network,  ip: "192.168.33.11",  type: "dhcp"

但是这导致了错误:

NFS requires a host-only network to be created. Please add a host-only network to the machine (with either DHCP or a static IP) for NFS to work

然后我在StackOverflow上读到另一个问题,即可以使用Vagrantfile中的以下代码配置一个仅限主机的网络:

  config.vm.network :private_network,  ip: "192.168.33.11"
  config.vm.network :public_network,  ip: "192.168.44.12"

  config.vm.synced_folder _conf['synced_folder'],
      _conf['document_root'], type: "nfs"

我认为192.168.44.0 255.255.255.0现在是托管网络,派生自ip:" 192.168.44.12"。它现在正常工作,我的WordPress网站速度更快,加载时间平均约为3秒。我很欣赏这种改进,但我会兜售其他调整。

额外信息,来宾中ifconfig的输出:

vagrant@vccw:~$ ifconfig
enp0s3    Link encap:Ethernet  HWaddr 08:00:27:a8:df:8b
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fea8:df8b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1156 errors:0 dropped:0 overruns:0 frame:0
          TX packets:788 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:277602 (277.6 KB)  TX bytes:97056 (97.0 KB)

enp0s8    Link encap:Ethernet  HWaddr 08:00:27:da:65:a0
          inet addr:192.168.33.11  Bcast:192.168.33.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feda:65a0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12461 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7004 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:10059912 (10.0 MB)  TX bytes:2671763 (2.6 MB)

enp0s9    Link encap:Ethernet  HWaddr 08:00:27:62:47:ec
          inet addr:192.168.44.12  Bcast:192.168.44.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe62:47ec/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:204 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:18654 (18.6 KB)  TX bytes:648 (648.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:18 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:1658 (1.6 KB)  TX bytes:1658 (1.6 KB)