Hugo - Start
GoHugo from Scratch
Take a fresh VM with OpenBSD ;) otherwise, you have to adapt appropriate …
install pkg
Login as User which is part of the “wheel group”. Doas should allow all Users of the Wheel Group to get root.
doas pkg_add hugo-- nginx--
adduser webmaster
create a user “webmaster” and prepare virtual directories
doas adduser webmaster
doas mkdir /var/www/virtual
doas chown webmaster /var/www/virtual/
Update Nginx
we need to modify nginx, prepare a site folder and a basic config for the webserver. do some stuff as root
doas su -
mkdir -p /etc/nginx/sites/ /var/log/nginx-nossl/
sed -i '$d' /etc/nginx/nginx.conf
echo " include /etc/nginx/sites/*.conf;" >> /etc/nginx/nginx.conf
echo "}" >> /etc/nginx/nginx.conf
cat << 'EOF' > /etc/nginx/sites/hugo1.conf
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name hugo1.intranet hugo1;
access_log /var/log/nginx-nossl/hugo1.log;
error_log /var/log/nginx-nossl/hugo1.error.log;
root /var/www/virtual/hugo1/public/;
index index.html index.htm;
}
EOF
Nginx
enable and start the nginx service
rcctl enable nginx
nginx -t && rcctl restart nginx
Webroot
switch to webaster, go to the virtual directory and create a new hugo page
doas su - webmaster
cd /var/www/virtual
hugo new site hugo1
cd hugo1
Themes
grab some themes … there are Lot of Themes available for you. grab one or build your own. https://themes.gohugo.io/
git clone https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
echo theme = \"ananke\" >> config.toml
First Page
create a first page and publish it
hugo new posts/my-first-post.md
sed -i 's/draft: true/draft: false/' content/posts/my-first-post.md
hugo
Open your Browser http://ip-of-your-webserver/
p.s. don’t worry about he IP Adress. The VM is already killed and it was just build for creating this blog Post …
Todo …
there is much more todo. Grab a Domain, grab a SSL Cert, implement Logrotation, implement a Backup, add some content, …
Any Comments ?
sha256: f2a860cf7cc8e47f868af0e53600c8c676b2fcbab775b5a69b63ffcf47c3debb