This site was built with Hugo 0.70.0.
To build static site
$ hugo
To run dev server on http://localhost:1313
$ hugo server -D --disableFastRender
This guide uses a clean installation of Ubuntu 18.04 hosted on a VPS. Ubuntu has been initialised with only a root user which is accessible via ssh.
Connect to the VPS as root
and run the following commands to install software needed later in this guide.
apt update
apt install -y sudo nginx
apt-get install git
If you are asked to overwrite a file named /etc/sudoers
, press "Y" to install the package maintainer's version.
At this stage you can verify nginx is installed correctly by entering your VSPs IP address into a web browser. The "Welcome to nginx" page should be loaded.
Still connected as root
, run the following command to create a new user. This example creates a user called jamie
, but you can choose your own name.
adduser jamie
Enter a strong password and, optionally, fill in any of the additional information if you would like. This is not required and you can just hit ENTER in any field you wish to skip.
Enable usage of sudo
for the new user.
usermod -aG sudo jamie
You can now disconnect from the root
user, and it will not be used again during this guide.
Connect to the VPS as the newly created non-root user. We are now going to install Hugo version 0.55.6.
export VER="0.70.0"
wget https://github.com/gohugoio/hugo/releases/download/v${VER}/hugo_${VER}_Linux-64bit.deb
sudo dpkg -i hugo_${VER}_Linux-64bit.deb
If installation was successful, you should now be able to use the hugo command
hugo --help
Still connected as the non-root user, clone this repository into a directory which can be served by nginx
sudo mkdir -p /var/www/block-commons
sudo chown -R $USER:$USER /var/www/block-commons
git clone https://github.com/block-commons/block-commons.git /var/www/block-commons
cd /var/www/block-commons
hugo
This should build the static site into a newly created directory named public/
sudo cp /var/www/block-commons/nginx/default /etc/nginx/sites-available/default
sudo systemctl restart nginx.service
The block-commons website should now be loaded when you enter your VSPs IP address into a web browser.
- Disable ssh for root user
- Configure public key auth for your non-root user
- Set up ufw to close unnecessary ports (Remember to keep 80, 443 and 22 open)
- Set up HTTPS
To deploy the latest changes pushed to the master branch on GitHub, connect to the VPS as the non-root user and run the following commands
cd /var/www/block-commons
git pull
hugo