LAN Hosting

In situation where you want to test the site across different devices. You need to configure your network firewalls and hugo server to match the necessary settings.

Configure Network Firewall

There is no one guide for this. The very first job is to check your router has internal firewall system that blocks your LAN machines from connecting to one another.

If it does, you can either set firewall exception rule to allow your server machine to access the IP:PORT.

Configure Host Firewall

Once done, you need to configure your local host firewall depending on your operating system. For example, on Debian with ufw, the command would be:

$ sudo ufw enable
$ sudo ufw default deny incoming
$ sudo ufw default allow outgoing
$ sudo ufw allow <PORT>

Replace the port with your port number.

Configure Hugo Server

Upon completion, the next thing is the Hugo Server. The trick is to --bind and set --baseURL to the same IP address. Example:

$ hugo server --bind [IP] --baseURL http://[IP] --port 8080

Once done, try connect the server using http://[IP]:8080 from other machine connected locally. You should be able to access the site. Of course, you can alter the port number if you wish.

That's all about using Hugo server as a local hosting server system.