Vagrant Jekyll 服务不可用

Vagrant Jekyll serve not available

我决定试试 Jekyll,但由于我还没有使用它,所以遇到了问题。当我上菜时,我在 http://127.0.0.1:4000/ 上得到 "This webpage is not available"。我正在使用 vagrant.

vagrant@ruby-jekyll-box:~$ jekyll new portfolio
New jekyll site installed in /home/vagrant/portfolio.
vagrant@ruby-jekyll-box:~$ cd portfolio/
vagrant@ruby-jekyll-box:~/portfolio$ jekyll serve
Configuration file: /home/vagrant/portfolio/_config.yml
            Source: /home/vagrant/portfolio
       Destination: /home/vagrant/portfolio/_site
      Generating...
                    done.
 Auto-regeneration: enabled for '/home/vagrant/portfolio'
Configuration file: /home/vagrant/portfolio/_config.yml
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.

我做错了什么?

您是否尝试从 vagrant box 内部访问它?还是从计算机上 运行 上的虚拟机? 127.0.0.1 是 localhost/loopback 所以 vagrant box 里面的 127.0.0.1 和你电脑上的 127.0.0.1 不一样。

尝试

jekyll serve --host=0.0.0.0

然后从位于 http://ip.of.vagrant.box:4000/

的主机访问它