无法从外面到达Vagrant上的Jekyll服务器

meg*_*ono 20 jekyll vagrant

我用hashicorp/precise32框构建了一个Vagrant虚拟机,并在其上安装了Jekyll.我在Vagrantfile上设置了端口4000转发:

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

当我尝试jekyll server它似乎一切正常,但我无法从外部到达服务器.

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.
Run Code Online (Sandbox Code Playgroud)

当我尝试通过curl到达服务器时,输出为:

curl: (56) Recv failure: Connection was aborted
Run Code Online (Sandbox Code Playgroud)

我已尝试在同一端口上的其他服务器,我可以到达它们,所以它似乎不是一个转发问题.

任何的想法?

编辑:

curl localhost:4000在VM内正常工作.出于某种原因,Jekyll的端口转发工作不正常.

meg*_*ono 44

错误发生了Server address: http://127.0.0.1:4000/.似乎localhost是Jekyll的默认主机,所以我需要运行jekyll serve --host 0.0.0.0服务器以便从外部使用.

我在这里找到答案:流浪汉端口转发不起作用.杯子不能从主人那里访问