Second vagrant machine doesn't serve php

42 views
Skip to first unread message

Kenoli Oleari

unread,
Oct 1, 2016, 8:04:28 PM10/1/16
to Vagrant
I have installed vagrant in virtualbox on my computer.  I have been able to set up a virtual vagrant machine in a directory and it works fine.

When I halt that machine and start another one in another directory it seems to set itself up OK but does not serve PHP.

When I halt it and go back to the first directly, it works fine.

I did have a problem when I first tried to set it up and got the message "Warning host identification has changed"  I delete the localhost key in the ~/.ssh/known_hosts file and it allowed me to start the machine.

Any idea why the second vagrant machine does not work?

--Kenoli

Kenoli Oleari

unread,
Oct 1, 2016, 8:05:30 PM10/1/16
to Vagrant
Addendum:  I'm on a mac with latest OSX.

Alvaro Miranda Aguilera

unread,
Oct 2, 2016, 9:32:18 AM10/2/16
to vagra...@googlegroups.com
Hello

Is very hard to guess what you are doing (commands) and what the goal is.

If you could setup a github repo and share some lines on:

"this is what I want to do"

"this is what I have tried"

"here is where It fail, I want this but i get this" or something similar.

happy to help, but just with the text is very hard to visualize what you are doing on your computer.

Thanks
Alvaro

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/31cb1fab-3a44-45ef-964d-958aded92d17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Kenoli Oleari

unread,
Oct 2, 2016, 3:54:19 PM10/2/16
to Vagrant
Alvaro -- Thanks for your reply.

I don't know how to do a github repo so here is what I did.

In the terminal:

studio: ~/Sites3 $ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> 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: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> 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: 4.3.36
    default: VirtualBox Version: 5.1
==> default: Mounting shared folders...
    default: /vagrant => /Users/studio/Sites3
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
studio: ~/Sites3 $ ssh -l vagrant -p 2222 localhost

The authenticity of host '[localhost]:2222 ([127.0.0.1]:2222)' can't be established.

ECDSA key fingerprint is SHA256:6wimww6bqYgs4b2ABrI73LCuvnlvMjQ1a0UkrNOZLb0.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '[localhost]:2222' (ECDSA) to the list of known hosts.

vagrant@localhost's password: 

Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-96-generic x86_64)


 * Documentation:  https://help.ubuntu.com/


  System information as of Sun Oct  2 19:38:35 UTC 2016


  System load:  0.22              Processes:           79

  Usage of /:   3.5% of 39.34GB   Users logged in:     0

  Memory usage: 24%               IP address for eth0: 10.0.2.15

  Swap usage:   0%


  Graph this data and manage this system at:

    https://landscape.canonical.com/


  Get cloud support with Ubuntu Advantage Cloud Guest:

    http://www.ubuntu.com/business/services/cloud


0 packages can be updated.

0 updates are security updates.


New release '16.04.1 LTS' available.

Run 'do-release-upgrade' to upgrade to it.



Last login: Sat Oct  1 01:58:53 2016 from 10.0.2.2

vagrant@vagrant-ubuntu-trusty-64:~$ 


Back to comments:


This like the box is up and running, though when I try to run a php file like this in a browser:


http://http://localhost:8080/Sites3/world.php


The browser says "Localhost refuses to connect"


When I do exactly the same thing in another directory, the connection is made and the rsult of the php script is displayed in the browser.


I must say that each time before I do I try to run "ssh -l vagrant -p 2222 localhost" after running "vagrant up" I get the message:


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!

Someone could be eavesdropping on you right now (man-in-the-middle attack)!

It is also possible that a host key has just been changed.

The fingerprint for the ECDSA key sent by the remote host is

SHA256:6wimww6bqYgs4b2ABrI73LCuvnlvMjQ1a0UkrNOZLb0.

Please contact your system administrator.

Add correct host key in /Users/studio/.ssh/known_hosts to get rid of this message.

Offending ECDSA key in /Users/studio/.ssh/known_hosts:4

ECDSA host key for [localhost]:2222 has changed and you have requested strict checking.

Host key verification failed.


I then have to delete the localhost key from the "~/,ssh/known_hosts" file and then it runs as above but will still not serve the file world.php.


Thanks,


--Kenoli




On Saturday, October 1, 2016 at 5:04:28 PM UTC-7, Kenoli Oleari wrote:

Alvaro Miranda Aguilera

unread,
Oct 9, 2016, 2:59:03 PM10/9/16
to vagra...@googlegroups.com

On Sun, Oct 2, 2016 at 9:54 PM, Kenoli Oleari <keno...@gmail.com> wrote:

http://http://localhost:8080/Sites3/world.php


The browser says "Localhost refuses to connect"


hello

http://http://localhost:8080/Sites3/world.php


The browser says "Localhost refuses to connect"


Welll the url have http:// two times.

Ok, so

if you ssh in the box, and from there you do

curl http://localhost:<port> works?

where port is the port where the web server is running on the VM.

Then on the Vagrnatfile you need to have:
a. port forward, say host 8080 -> guest 80

when this is done, after vagrant reload:
- ssh and check webserver works inside the VM
- try from host as http://127.0.0.1:8080

at this point if doesn't work could mean firwall or vpn.

Share a Vagrantfile over gist.github.com
and if you setup the VM using more scripts, then create a project on github.com

happy to help, but logs are not helping much :)

Alvaro


--
Alvaro

Reply all
Reply to author
Forward
0 new messages