Struggling to access hugo server on local network

I’m running my server: hugo server --bind=0.0.0.0 --baseURL=http://0.0.0.0:1313 -D

I get no errors. I can see it fine on that computer at http://localhost:1313 but if I go to that computer’s IP (at 1313) on other devices on the network I get no connection.

I’m running hugo on nixos. I’m trying to access it on my android phone and windows computer.

what other information may I offer? any ideas?

Your NixOS firewall is blocking incoming TCP connections over port 1313.

See https://nixos.org/manual/nixos/stable/index.html#sec-firewall

1 Like

thank you, you’re amazing. should I change the baseURL to reflect my IP?

I can access the site and it all shows properly on my other devices, but when I click a link it changes from my development computer’s IP to 0.0.0.0

If your private address is 192.168.1.99, then run:

hugo server --bind 192.168.1.99 --baseURL http://192.168.1.99

The default port is 1313. If you want to listen on port 8080:

hugo server --bind 192.168.1.99 --baseURL http://192.168.1.99 --port 8080
1 Like

that fixed it. thank you!! <3

just in case others read this: when I check the site locally I have to use my devices IP instead of localhost, but it works great!

Of course: localhost is equivalent to 127.0.0.1, it is bound to the interface lo. So if you use localhost in an URL, the browser will connect to 127.0.0.1. If, on the other side, you run a webserver on 162.168.1.x (which is bound to the interface en-something or wlan-something), you have to connect to this IP. If you’d want to use a symbolic name instead (like “my-lovely-hugo-host”), you’d have to either setup a DNS or add an appropriate entry to your /etc/hosts file.

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