自定义域不适用于宅基地

Custom domain does not work for homestead

我对使用宅基地在本地开发 laravel 网站是全新的。我按照两个不同的教程进行设置并重新安装了大约 5 次,但自定义域名对我不起作用。我正在 windows 10 机器上工作,并且正在使用 Virtualbox。当我在浏览器中浏览到 192.168.10.10 时,我能够看到测试站点。我可以 ping 192.168.10.10 并获得所有发送和接收的数据包。我还可以 ping obsessories.dev 它成功发送和接收所有数据包。我还尝试根据我在 SO 上看到的另一个答案更改我的主机文件以使用 127.0.0.1,但这对我不起作用。我使用命令

vagrant reload --provision

每次我对 Homestead.yaml 和我的主机文件进行任何更改时。我注意到 firefox 和 chrome 都重定向到 https://obsessories.dev,但我不确定这是否是个问题。感谢提前对此提供的任何帮助或见解!

这是我的 Homestead.yaml 文件:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: C:\Users\******\Projects\web\ssh\publickey.pub

keys:
    - C:\Users\******\Projects\web\ssh\privatekey.ppk

folders:
    - map: C:\Users\******\Projects\web\sites
      to: /home/vagrant/code

sites:
    - map: obsessories.dev
      to: /home/vagrant/code/obsessories/public

databases:
    - homestead

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# zray:
#  If you've already freely registered Z-Ray, you can place the token here.
#     - email: foo@bar.com
#       token: foo
#  Don't forget to ensure that you have 'zray: "true"' for your site.

ping 192.168.10.10 的输出

ping 192.168.10.10

Pinging 192.168.10.10 with 32 bytes of data: Reply from 192.168.10.10: bytes=32 time<1ms TTL=64 Reply from 192.168.10.10: bytes=32 time<1ms TTL=64 Reply from 192.168.10.10: bytes=32 time<1ms TTL=64 Reply from 192.168.10.10: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.10.10: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms

ping 输出 obsessories.dev

ping obsessories.dev

Pinging obsessories.dev [192.168.10.10] with 32 bytes of data: Reply from 192.168.10.10: bytes=32 time<1ms TTL=64 Reply from 192.168.10.10: bytes=32 time<1ms TTL=64 Reply from 192.168.10.10: bytes=32 time<1ms TTL=64 Reply from 192.168.10.10: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.10.10: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms

乔的建议对我有用。我改为将域更改为 .local 并重新加载 vagrant 并且现在工作正常。