http://127.0.0.1:8888/ not visible on host machine
I had this all working on an older macbook. After upgrading, I installed the latest version of virtualbox (4.2.16) and vagrant (1.3.1) on mountain lion (10.8.4).
My vagrant up is very clean and I don't see any errors. Here is a snippet of the startup -
Bringing machine 'default' up with 'virtualbox' provider... [default] Importing base box 'precise64'... [default] Matching MAC address for NAT networking... [default] Setting the name of the VM... [default] Clearing any previously set forwarded ports... [default] Creating shared folders metadata... [default] Clearing any previously set network interfaces... [default] Preparing network interfaces based on configuration... [default] Forwarding ports... [default] -- 22 => 2222 (adapter 1) [default] -- 8000 => 8888 (adapter 1) [default] Booting VM... [default] Waiting for machine to boot. This may take a few minutes... [default] Machine booted and ready! [default] Mounting shared folders... [default] -- /vagrant [default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks [default] -- /tmp/vagrant-chef-1/chef-solo-2/cookbooks [default] Running provisioner: shell... [default] Running: inline script
The port forwarding is very explicit and as you can see I don't see any port conflicts. Everything runs fine and I can run the django server on the vm just fine. I opened another terminal session into the vm and verified that I see the django welcome page when I run - curl 'http://127.0.0.1:8000'.
Now from my host machine when I open a webpage to http://127.0.0.1:8888/ I get blank screen. Checking for response using curl gives me -
➜ ~ curl 'http://127.0.0.1:8888/' curl: (52) Empty reply from server ➜ ~ curl -v 'http://127.0.0.1:8888/' * About to connect() to 127.0.0.1 port 8888 (#0) * Trying 127.0.0.1... * connected * Connected to 127.0.0.1 (127.0.0.1) port 8888 (#0)
GET / HTTP/1.1 User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8x zlib/1.2.5 Host: 127.0.0.1:8888 Accept: /
- Empty reply from server
- Connection #0 to host 127.0.0.1 left intact curl: (52) Empty reply from server
- Closing connection #0
Has anybody seen this issue?I wish I had made a note what version of software I had which worked. Can anybody give me a combination of what version of vagrant and virtualbox works for them?
Thank you
Answers
Sorry for the messed up snippets. Here is my startup snippet -
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise64'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 8000 => 8888 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] Mounting shared folders...
[default] -- /vagrant
[default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks
[default] -- /tmp/vagrant-chef-1/chef-solo-2/cookbooks
[default] Running provisioner: shell...
[default] Running: inline script
Here is the snippet when I check http://127.0.0.1:8888 from my host machine - ``` ➜ ~ curl 'http://127.0.0.1:8888/' curl: (52) Empty reply from server ➜ ~ curl -v 'http://127.0.0.1:8888/' * About to connect() to 127.0.0.1 port 8888 (#0) * Trying 127.0.0.1... * connected * Connected to 127.0.0.1 (127.0.0.1) port 8888 (#0)
GET / HTTP/1.1 User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8x zlib/1.2.5 Host: 127.0.0.1:8888 Accept: /
- Empty reply from server
- Connection #0 to host 127.0.0.1 left intact curl: (52) Empty reply from server
- Closing connection #0 ```
I found the solution!! I was doing this by memory and forgot to add the trick you showed to have the 8000 port available to the host machine. Running the server the way you showed worked for me -
python manage.py runserver 0.0.0.0:8000
I was skipping the 0.0.0.0:8000 part.
Sorry again.. I hope I get it right this time.
Here is my startup snippet -
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise64'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 8000 => 8888 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] Mounting shared folders...
[default] -- /vagrant
[default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks
[default] -- /tmp/vagrant-chef-1/chef-solo-2/cookbooks
[default] Running provisioner: shell...
[default] Running: inline script
Here is the snippet when I check http://127.0.0.1:8888 from my host machine -
➜ ~ curl 'http://127.0.0.1:8888/'
curl: (52) Empty reply from server
➜ ~ curl -v 'http://127.0.0.1:8888/'
* About to connect() to 127.0.0.1 port 8888 (#0)
* Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8888 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8x zlib/1.2.5
> Host: 127.0.0.1:8888
> Accept: */*
>
* Empty reply from server
* Connection #0 to host 127.0.0.1 left intact
curl: (52) Empty reply from server
* Closing connection #0