Hugo Server Confusion

Hugo Version: 0.17
Dev OS: Opensuse Tumbleweed

I have completed the Bookshelf tutorial and everything looks and runs great. I set all posts to “undraft” and generated the site which created a “/public” directory with the contents.

Now I copied the contents of the public directory to a “/site” directory on my laptop and I want to use hugo as a webserver.

I know there are other better webservers (I have experience with nginx), but I want to use hugo as a standalone webserver or is this possible?

When I issue the command “hugo server” from the site directory I get an error message “Error: Unable to locate Config file”. I also tried using the -c and -s parameters and received the same error message.

What is the proper way to use hugo as a standalone webserver, say for a single “hello world” html file, which should translate to using with the generated site in the “/public” directory?


The hugo server command both builds and serves content. It complained about the lack of a config file in your case because it tried to build the site and couldn’t find the source files. You have to run it where your site files are, so config.toml, the content and themes directory and so on.

As for running it in production, looking at the output of hugo server --help it’s not unreasonable:

While hugo server is high performance, it is a webserver with limited options.
Many run it in production, but the standard behavior is for people to use it
in development and use a more full featured server such as Nginx or Caddy.

Thanks for the reply. I was playing with distributing a static website in a docker container and thought I could use hugo as a webserver.

I ended up writing a simple webserver using go and installed it, and the generated website, in an Alpine Linux container with s6 overlay and dns.

I definitely want to try out Caddy.


You should be able to use hugo server in a Docker container. Something along these lines should work:

FROM debian:jessie

RUN apt-get update && apt-get install -y \
	python-pygments \


RUN curl -LsS${HUGO_VERSION}/${HUGO_BINARY} -o /tmp/hugo.deb \
	&& dpkg -i /tmp/hugo.deb \
	&& rm /tmp/hugo.deb



COPY . /app/

ENTRYPOINT ["hugo", "server"]

Then you can docker run it with a port mapping of the containers 1313 port to the host’s 80 port.