【问题标题】:Laravel homestead and vagrant setup not workingLaravel 宅基地和流浪者设置不起作用
【发布时间】:2016-07-30 09:57:22
【问题描述】:

我遵循了 vagrant 和 homestead 的原始文档,但是您访问的每个 site.app:8000 都在不断加载,没有任何反应。这个配置文件有错误吗?

Homestead.yaml

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

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Developer/laravel
      to: /home/vagrant/laravel

sites:
    - map: hello-world.local
      to: /home/vagrant/laravel/hello-world/public

databases:
    - homestead

主机

192.168.10.10    hello-world.local

流浪日志

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 80 (guest) => 8000 (host) (adapter 1)
    default: 443 (guest) => 44300 (host) (adapter 1)
    default: 3306 (guest) => 33060 (host) (adapter 1)
    default: 5432 (guest) => 54320 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: 
    default: Guest Additions Version: 5.0.20
    default: VirtualBox Version: 5.1
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => /Users/nikla/Developer/homestead
    default: /home/vagrant/laravel => /Users/nikla/Developer/laravel
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

nmap 日志

Starting Nmap 7.12 ( https://nmap.org ) at 2016-07-29 22:55 ART
Nmap scan report for 192.168.10.10
Host is up (0.00063s latency).
Not shown: 994 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
443/tcp  open  https
3306/tcp open  mysql
5432/tcp open  postgresql
9000/tcp open  cslistener

Nmap done: 1 IP address (1 host up) scanned in 13.19 seconds

【问题讨论】:

  • 您不需要:8000。考虑到您显示的设置,一旦您vagrant up,您应该能够将您的浏览器指向http://test.app
  • 你是否在编辑完yaml文件后运行了“vagrant provision”?
  • 是的,我做到了。我还重新启动了主机并使用已配置的 yaml 文件启动了 vagrant。

标签: laravel vagrant homestead


【解决方案1】:

我检查了你的“vagrant up”日志,我发现一切正常。我已经将您的日志与我机器的日志进行了比较,并且相似。

尝试在网络浏览器中打开 IP(用你的 Vagrant VM IP 更改 IP):

http://192.168.10.10/

您是否有一些防火墙、防病毒软件或其他可能会禁用通信的软件?

尝试执行 nmap 以查看打开的端口。我将我的 nmap 从我的主机粘贴到我的虚拟机,这样你就可以看到打开的端口。

$ nmap 192.168.10.10

Starting Nmap 6.47 ( http://nmap.org ) at 2016-07-30 01:48 Hora de verano romance
Nmap scan report for homestead.app (192.168.10.10)
mass_dns: warning: Unable to determine any DNS servers. Reverse DNS is disabled. Try using --system-dns or specify valid servers with --dns-servers
Host is up (0.0019s latency).
Not shown: 993 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
111/tcp  open  rpcbind
443/tcp  open  https
3306/tcp open  mysql
5432/tcp open  postgresql
9000/tcp open  cslistener
MAC Address: 08:00:27:CD:99:8C (Cadmus Computer Systems)

Nmap done: 1 IP address (1 host up) scanned in 21.83 seconds

【讨论】:

  • 进展顺利,我收到“未指定输入文件”。进入 192.168.10.10 时。也许权限有问题?我之前在 ~/developer/laravel 文件夹上 chmod -R 777 。我刚刚用 nmap 日志更新了帖子。
  • 好的,现在您可以访问 Vagrant VM 机器,但不能访问正确的文件夹。检查 /home/vagrant/laravel/hello-world/public/ 文件夹是否存在以及它是否具有正确的元素(资产、.htaccess、index.php、robots.txt、web.config)、权限,然后检查论坛:laravel.io/forum/…
  • 现在我在输入IP时得到了laravel 5索引。但是去 .local 不起作用,并且主机文件设置正确。有什么想法吗?
  • "192.168.10.10 hello-world.local" 必须有效。现在我认为这可能是 nginx 虚拟主机的一些问题。您可以粘贴 /etc/nginx/sites-enabled/ 内容:“ls /etc/nginx/sites-enabled/”和您的域虚拟主机的内容“更多 /etc/nginx/sites-enabled/hello-world.local " ??
  • 我粘贴了我的 Laravel 别名 jesusamieiro.com/laravel-bash-alias
【解决方案2】:

检查:

  • id_rsa.pub 和 id_rsa 位于此文件夹中。
  • /Users/nikla/Developer/laravel 文件夹存在于您的主机中。
  • /home/vagrant/laravel 存在于您的 Vagrant VM 机器中。您可以使用“vagrant ssh”命令在机器上登录。
  • 尝试在没有 8000 端口的情况下访问http://test.app

我没有在您的 Homestead.yaml 文件中看到数据库。您应该在此文件中包含下一个文本

databases:
    - homestead

【讨论】:

  • 所有这些都已检查,我使用的是 OSX。你还有什么建议吗?
  • 执行“vagrant up”时能否粘贴控制台输出?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-16
  • 2018-08-17
  • 2015-08-25
  • 1970-01-01
  • 2017-11-08
  • 2016-04-07
相关资源
最近更新 更多