One of my first challenges with using Jekyll was trying to deploy a blog on my Digital Ocean droplet. Initially, I was following the guide at this link, only to realise a few problems:
The default Capistrano is now version 3, instead of version 2 on the guide. Unfortunately, the core of Capistrano 3 is completely different from Capistrano 2 so none of the instructions can be used.
Even though I eventually tried to download Capistrano 2, i still ran into issues trying to get it to run.
I spent a few days trying to get my jekyll up and eventually, I realised that I actually didn’t need Capistrano. The reason for this is: While looking through the Jekyll documentation, I came to the realization of the meaning of “static” - whenever jekyll serve is executed, it looks through all the layout/posts/etc… folders, and actually generates a full html for everything into the sub-folder _site/. I didn’t actually care about anything else besides the webpage being updated as I updated my blogposts, so just jekyll serve worked plenty fine for me.
Check that nginx is already running by keying in your ip address/domain name into your browser. If the nginx default page appears, it means it is up. Otherwise, it can be started by running this command in a shell:
nginx
or
service nginx start
Download jekyll:
gem install jekyll
Checking the nginx website, the default location where a nginx webpage is stored at is /usr/share/nginx/html , so let's navigate to that folder:
cd /usr/share/nginx/html
If the folder is not empty, feel free to clear it. Setup a default jekyll blog at that directory, and then run 'jekyll serve' to generate the static files:
rm-r(whatever files there)
jekyll new .
jekyll serve
Next, change the nginx configuration file to point to the _site/ sub-directory, because that's where the static files will be generated.
cd /etc/nginx/sites-available/
vim default
Look for the line that says:
root /usr/share/nginx/html
and change it to:
root /usr/share/nginx/html/_site
The default jekyll blog should be up now if you refresh your tab. To continuously update the static files whenever any posts are added, just run Jekyll in the background: