Deploying Hugo the Golang CMS on DigitalOcean

Creating a Droplet

I am a bit partial to CentOS. The lastest version as of this writing is CentOS Linux release 7.1.1503 (Core).

Setting up a droplet is always very simple. Just turn it on basically. Upload your ssh keys. Done.

Install Nginx

Add the epel repo:

yum install epel-release


yum install nginx

Start it

service nginx start
systemctl enable nginx

Create the Folders

mkdir -p /var/www/ursite/
chown -R nginx:nginx /var/www
touch /var/www/ursite/index.html - or clone your site
cp /etc/nginx/sites-available/default /etc/nginx/sites-available/ursite

Configure nginx

open the config file: vim /etc/nginx/conf.d/virtual.conf

Add the following:

## A virtual host using mix of IP-, name-, and port-based configuration

server {
    listen       80;

    location / {
        root   /var/www/stac/public/;
        index  index.html;
Install Go + Hugo
yum install go

I decided to install from source Edit your bash script to have the proper variables in place.

yum install git hg
export GOPATH=$HOME/go
go get -v
cp $GOPATH/bin/hugo /usr/local/bin/

NOTE: THis actually isn’t necessary. Just check it out and go with it. Afer screwing with it a few minutes I facepalmed… they are static files. Doh!