How to serve Hugo site?


I’m trying to create a blog with Hugo and serve it with Caddy.

So far I managed to install Caddy and Hugo without problems, also I created the Hugo site with a test post but when I try to run caddy and go to the website it returns a Not Found error.

My Caddy file looks like this: {
    root /blog/public

Any clue why it’s not working?

Hi Pablo –

When you do ls /blog/public what do you see?

I see:

~/blog/public$ ls
categories  help  index.xml  sitemap.xml  tags

No, I mean, run this command exactly:

ls /blog/public

And you will see what I’m getting at. :wink:

1 Like

oooh! my bad, sorry

I ment that my Caddyfile looks like this (I wrote it, instead of copying it…): {
    root ~/blog/public 

I also tried with the absolute path

I get 404 with both

There you go. :slight_smile: The tilde version won’t work in the Caddyfile because ~ is a bash expansion, not a Caddy one.

The absolute path works, but a 404 means there is no index file found. This page has the index files that are recognized by Caddy: Welcome — Caddy Documentation

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.