Last Updated: February 25, 2016
·
2.061K
· rarous

Serving Jekyll site via Vagrant machine

In the root of your jekyll site create a Vagrantfile:

Vagrant::Config.run do |config|

  config.vm.box = "precise32"
  config.vm.box_url = "http://files.vagrantup.com/precise32.box"
  config.vm.forward_port 4000, 4000
  config.vm.provision :shell,
    :inline => "sudo apt-get update && sudo apt-get -y install build-essential git ruby1.9.3 && sudo gem install github-pages --no-ri --no-rdoc"

  config.ssh.forward_agent = true
end

Start the machine and connect to SSH:

$ vagrant up
$ vagrant ssh

Now, you can start Jekyll on the machine:

$ cd /vagrant/
$ jekyll serve -twP 4000

Your site is served on http://localhost:4000/ address.

When you are done just pres ctrl+c and then type exit.

1 Response
Add your response