我正在学习larcast教程,以启动和运行laravel。我已经设置好了laravel,现在它可以正常工作了。我希望它能在我的窗口上流浪。但当我浏览"todo.app:8000"时,我无法运行我的应用程序。页面没有响应,并显示消息"网页不可用。"
然而,当我第一次设置它时,我可以通过"localhost:8000"访问页面,而我访问它时没有"php artisan serve"命令,但无法使用"todo.app:8000"。之后,我更新了composer并重新启动了机器,情况变得更糟了。现在,我甚至无法使用"localhost:8000hp artisan serve",它可以正常工作。此外,在管理家园、流浪者或拉拉威尔命令方面也没有错误——他们工作得很好
谁能告诉我做错了什么吗?这是我的家园.yml文件
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/code
to: /home/vagrant/code
sites:
- map: todo.app
to: /home/vagrant/code/learning-laravel-5/public
databases:
- homestead
variables:
- key: AAP_ENV
value: local
# blackfire:
# - id: foo
# token: bar
# client-id: foo
# client-token: bar
# ports:
# - send: 50000
# to: 5000
# - send: 7777
# to: 777
# protocol: udp
这些是我在windows主机文件中所做的配置
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 todo.app
127.0.0.1 mynew.app
如果还需要什么,也请告诉我。我已经花了一整天的时间想办法了,但我被困在这里了。提前感谢
有几点需要解决(1和2应该可以解决您的问题):
-
您不能让todo.app指向您的
127.0.0.1
,您需要将127.0.0.1
更改为VM(192.168.10.10
)的IP -
会的http://todo.app不http://todo
-
你有端口转发吗?从你的摘录中,它评论道,你是转发80到8000,还是在虚拟机的8000端口上运行了一些东西?
如果执行localhost:8000,则假定您已将端口80从虚拟机转发到主机上的8000,而todo.app:8000将直接指向虚拟机并从虚拟机的8000端口获取正在运行的内容。
- 你有一个固定的IP地址,所以你可以使用
http://192.168.10.10
访问你的laravel