Can't surf to Vagrant VM web server from host

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Can't surf to Vagrant VM web server from host

Devon Campbell
This could very well be a problem not related to Vagrant, but I'm not sure where to start diagnosing it. I'm running gunicorn proxied through nginx on a Vagrant VM. I've got a Django project skeleton being served, and I'd love to see it working from the dev environment before I start filling it out. Unfortunately, when I try to hit the page on the host, Chrome tells me the server closed the connection without sending any data.

My VagrantFile is included in the Github repo for the project if that would help anyone diagnose the problem. I'd really appreciate any guidance whatsoever. I'm not sure where to go from here. Thanks!

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Can't surf to Vagrant VM web server from host

Aaron Aaron
I don't know where your issue might be. I glanced over your github files.

If it was me, I'd install lynx or some other text browser, and then start connecting to things from the innermost to the outer most. Framework, then app server, then nginx, then gunicorn.

From the other end, you might temporarily replace your stack (with another vagrant box, yay!) but the same network settings, and see where you get with that.

I'd like to know what you find.

On Tuesday, April 16, 2013 3:53:05 PM UTC-6, Devon Campbell wrote:
This could very well be a problem not related to Vagrant, but I'm not sure where to start diagnosing it. I'm running gunicorn proxied through nginx on a Vagrant VM. I've got a Django project skeleton being served, and I'd love to see it working from the dev environment before I start filling it out. Unfortunately, when I try to hit the page on the host, Chrome tells me the server closed the connection without sending any data.

My VagrantFile is included in the Github repo for the project if that would help anyone diagnose the problem. I'd really appreciate any guidance whatsoever. I'm not sure where to go from here. Thanks!

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Can't surf to Vagrant VM web server from host

Jin Zhang
In reply to this post by Devon Campbell
From first glance, your problem seems to be that you're accessing Gunicorn directly instead of through Nginx as you're expecting to do.

Your Gunicorn script is binding to ADDRESS=localhost:8000 and your Vagrantfile is forwarding host port 8888 to port 8000. 
So the problem is that Gunicorn is setup to only listen from localhost request, which if you're accessing through Vagrant, it is considered an outside request. To fix this, you can bind ADDRESS=0.0.0.0:8000 which will allow anyone to connect to Gunicorn.

But the real problem is that you should be routing traffic through Nginx and not Gunicorn. Nginx by default is setup to listen on port 80 which you have not forwarded with Vagrant. You need to add this line to your Vagrantfile: 
config.vm.network :forwarded_port, guest: 80, host: 8001

Then on your local machine, you can enter in localhost:8001 and it should work.


On Tuesday, April 16, 2013 2:53:05 PM UTC-7, Devon Campbell wrote:
This could very well be a problem not related to Vagrant, but I'm not sure where to start diagnosing it. I'm running gunicorn proxied through nginx on a Vagrant VM. I've got a Django project skeleton being served, and I'd love to see it working from the dev environment before I start filling it out. Unfortunately, when I try to hit the page on the host, Chrome tells me the server closed the connection without sending any data.

My VagrantFile is included in the Github repo for the project if that would help anyone diagnose the problem. I'd really appreciate any guidance whatsoever. I'm not sure where to go from here. Thanks!

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.