Windows 10 个主机文件不工作 Laravel Homestead
Windows 10 Hosts file not working Laravel Homestead
我正在尝试让 windows 将 homestead.localhost 重定向到我在 Laravel Homestead 中设置的站点。但它不允许我访问该页面。我可以通过转到 192.168.10.10 来访问我设置的站点,但是在我的浏览器中转到 http://homestead.localhost 会出现:
ERR_CONNECTION_REFUSED
我的 windows 主机文件,其中唯一的一行,有
192.168.10.10 homestead.localhost
这是我的 Homestead.yaml:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: C:/Users/jarro/Documents/Sites
to: /home/vagrant/Sites
sites:
- map: homestead.localhost
to: /home/vagrant/Sites/homestead
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
所以问题是,为什么我的 windows 10 主机不工作。
我做了以下事情:
清除IP配置,重启电脑,删除并创建一个新的vagrant,然后重新加载vagrant。
我错过了什么?
sites:
- map: homestead.localhost
to: /home/vagrant/Sites/homestead
您必须将站点映射到 Laravel 项目的 "public" 文件夹!类似于:
至:/home/vagrant/Sites/myLaravelProject/public
宅基地没有任何index.php可以参考。
所以在放弃了大约一个星期后,我决定回去再试一次。在 Laracasts 上找到 post:
要修复我所做的,您只需在 url 上添加 :8000 即可加载网站。由于某种原因,它无法在端口 80 上工作。我现在要去解决这个问题,这样我就可以安息了。
:D
这是一个老问题,但在 Hosts 文件中我发现使用它更容易:
127.0.0.1 myapp.local
它每次都有效。我在使用 192.168.10.10
时总是遇到一些小问题
我正在尝试让 windows 将 homestead.localhost 重定向到我在 Laravel Homestead 中设置的站点。但它不允许我访问该页面。我可以通过转到 192.168.10.10 来访问我设置的站点,但是在我的浏览器中转到 http://homestead.localhost 会出现:
ERR_CONNECTION_REFUSED
我的 windows 主机文件,其中唯一的一行,有
192.168.10.10 homestead.localhost
这是我的 Homestead.yaml:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: C:/Users/jarro/Documents/Sites
to: /home/vagrant/Sites
sites:
- map: homestead.localhost
to: /home/vagrant/Sites/homestead
databases:
- homestead
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
所以问题是,为什么我的 windows 10 主机不工作。
我做了以下事情:
清除IP配置,重启电脑,删除并创建一个新的vagrant,然后重新加载vagrant。
我错过了什么?
sites: - map: homestead.localhost to: /home/vagrant/Sites/homestead
您必须将站点映射到 Laravel 项目的 "public" 文件夹!类似于:
至:/home/vagrant/Sites/myLaravelProject/public
宅基地没有任何index.php可以参考。
所以在放弃了大约一个星期后,我决定回去再试一次。在 Laracasts 上找到 post:
要修复我所做的,您只需在 url 上添加 :8000 即可加载网站。由于某种原因,它无法在端口 80 上工作。我现在要去解决这个问题,这样我就可以安息了。
:D
这是一个老问题,但在 Hosts 文件中我发现使用它更容易:
127.0.0.1 myapp.local
它每次都有效。我在使用 192.168.10.10
时总是遇到一些小问题