note this is NOT related to Apache and I'm not looking for Apache-centered answers.
I am using the Hugo static site generator to create sites and trying to test on a MacBook running Sierra.
I am able to start the server with
hugo server -Dw
And the server starts on localhost:1313, however when I try to access that URL I get a 404. 127.0.0.1:1313 works, but then all of the links fail as they try to resolve back to localhost.
I was able to access by enabling a domain name on my router (foo.home) and then I can open the main page with localhost.foo.home:1313, but all of the Hugo links still try to use localhost:1313.
So, two questions:
- Can I change the behavior of Hugo to use 127.0.0.1? I tried changing the baseURL in config.toml to localhost, 127.0.0.1 and the foo.home domains, but that didn't seem to do anything.
- Or, can I change the /etc/hosts file to resolve localhost?
Right now /etc/hosts has four entries - I am wondering if I can add another entry for 127.0.0.1 localhost but there's a warning about not making changes as it will break configuration of the loopback interface.
127.0.0.1 localhostw
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
localhost
is just the hostname of the IP127.0.0.1
; they are the same thing. The problem that I am seeing is your first link in youretc/hosts
file - you have a trailingw
. It should belocalhost
hugo
is for some reason failing to listen for IPv6 connections; if this is the case, you can still have trouble connecting via localhost. Trynetstat -an | grep '[.]80 '
and see if it lists listeners on the IPv6 addresses as well as IPv4.