Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot reach Jekyll server on Vagrant from outside

Tags:

I've built a Vagrant VM with hashicorp/precise32 box and installed Jekyll on it. I've set port 4000 forwarding on Vagrantfile:

config.vm.network :forwarded_port, host: 4000, guest: 4000

When I try jekyll server it seems everything works fine, but I cannot reach the server from outside.

Configuration file: /vagrant/test-site/_config.yml
Source: /vagrant/test-site
Destination: /vagrant/test-site/_site
Generating...
                done.
Auto-regeneration: enabled for '/vagrant/test-site'
Configuration file: /vagrant/test-site/_config.yml
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.

When I try to reach the server via curl, the output is:

curl: (56) Recv failure: Connection was aborted

I've tried with other servers on same port and I can reach them, so it not seems a forwarding problem.

Any idea?

Edited:

curl localhost:4000 works correctly inside VM. For some reason, the port forwarding is not working properly for Jekyll.

like image 306
megalomono Avatar asked Dec 23 '14 09:12

megalomono


1 Answers

The error was on Server address: http://127.0.0.1:4000/. It seems that localhost is the default host for Jekyll, so I need to run jekyll serve --host 0.0.0.0 for the server to be available from outside.

I find the answer here: Vagrant port forwarding not working. Cups not accesible from host

like image 126
megalomono Avatar answered Sep 19 '22 17:09

megalomono