Install Hugo on a Shared Hosting
Since 2012, this website hosted a WordPress site. In the beginning, I wrote some infosec related articles but like the vast majority of blogs, I didn’t have enought time to produce content. That’s why I installed a WP plugin to fetch news articles from various infosec sources and publish them. But what’s my added value in this? none
So 2020 start and I want to focus more on learning & sharing. That will be the goal of this site.
But why did I want to change from WordPress to Hugo ?
- First I only logged once a year on the WP admin so my WP core, pluggins & themes were rarely updated
- Because I fetch articles to generate posts, my shared host DB was full
- Some infosec friends loudly praised static generated sites
So here we go!
One last thing, I wanted 100% of this hosted on my shared OVH hosting…
What is Hugo?
Hugo is an Open Source static site generator written in Go. You feed him whith your content using markdown syntax & theme and it generate you a static website.
Usually, you keep hugo binaries and your content source files (*.md) on your local machine but I wanted to host all of these on my web host.
PHP shell?!!
OVH don’t provide shell on shared hosting so the first step is to upload yours. You can find scripts online or simply use msfvenom to generate your private shell.
I won’t provide links because you put your web space at risk if you don’t be cautious with this. Always restrict access to sensitive pages on your host.
Once it’s done, you can download hugo binaries.
wget https://github.com/gohugoio/hugo/releases/download/v0.65.0/hugo_0.65.0_Linux-64bit.tar.gz
and your theme (I use the cupper theme):
git init
git submodule add https://github.com/zwbetz-gh/cupper-hugo-theme.git themes/cupper
Tweaking
No you can tweak your site following this Quickstart guide
Go online
Last step, ask Hugo to generate your static site
./hugo -D
You can even change the generated pages location (if you use hugo in a protected/hidden directory) :
./hugo -D -d ../www