21

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.

1 Answer 1

46

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.