Set up a Jekyll blog from scratch

It took me a while to set up this blog from scratch. I want to document what I did so it will help others and it would be a good reference for myself in the future.

This article follows the following articles by digitalocean and a few others.
How To Get Started with Jekyll on an Ubuntu VPS
How to Set Up a Jekyll Development Site on Ubuntu 16.04
How to install nginx on ubuntu 16.05
How To Secure Nginx with Let’s Encrypt on Ubuntu 16.04
Using rsync to Deploy Your Jekyll Site
Markdown Cheatsheet

I am going to assume you have a VPS or any other server and a domain name. Running either Ubuntu or Debian.

Installing Jekyll

Let us first update our package manager to ensure we have the latest packages.

sudo apt-get update

Now we have to install ruby since jekyll depends on ruby.

sudo apt-get install ruby

When that is done we can use Ruby’s gem package manager to install Jekyll. We will also need Bundler to manage Gem dependencies.

sudo gem install jekyll bundler

Creating our site

In our home directory we will deploy our site.

cd ~
jekyll new <website>

Our default theme is minima. We will now run Bundler to install the theme.

cd ~/<website>
bundle install

To adjust our website to our liking we can change the content of _config.yml.

Starting Jekyll’s Web Server

In our website’s folder we can serve the site so we can preview it.

cd ~/<website>
jekyll server --host 123.123.123

if no host is given you can view your site at http://localhost:4000 The standard port is 4000.

Set up our webserver using nginx

First let’s install nginx

sudo apt-get install nginx

Now when you go to your domain or ip adress you should see a splash screen with welcome to nginx

cd /etc/nginx/sites-available
sudo cp /etc/nginx/sites-available/default

Minimum config for nginx

server {
  # listen on http (port 80)
  # remove the "default_server" if you are running multiple sites off the same VPS
  listen 80 default_server;

  # the IP address of your VPS
  # see for options
  # to use your own domain, point a DNS A record at this IP address
  # and set the server name to (eg.) ""

  # the path you deployed to. this should match whatever was in your
  # Capistrano deploy file, with "/current" appended to the end
  # (Capistrano symlinks to this to your current site)
  root /home/deployer/blog/_site;
  index index.html

  # how long should static files be cached for, see for options.
  expires 1d;
sudo ln -s /etc/nginx/sites-available/