Allow me to explain what I mean by «does not work»:
Everything works just fine when I run hugo server
without any optional parameters. My website is available on http://localhost:1313
just as you would expect.
However, I’d also like to test my website from my phone (I know I can resize my browser window, but it’s not the same), so I run the server with the following command:
hugo server --bind=10.0.10.117 --baseURL=http://10.0.10.117:1313
With the following result:
Web Server is available at http://10.0.10.117:1313/ (bind address 10.0.10.117)
Using lsof
and netstat
, I can confirm that Hugo is running and listening to 10.0.10.117:113:
$ lsof -nP -i4TCP:1313
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
hugo 54512 runar 47u IPv4 0xcb0fb61723a1db43 0t0 TCP 10.0.10.117:1313 (LISTEN)
$ netstat -an -ptcp | grep LISTEN
tcp4 0 0 10.0.10.117.1313 *.* LISTEN
However, opening http://10.0.10.117:1313 in any browser simply does not work. The error message is in Norwegian, so I’ll show you the output from curl
instead:
$ curl -v -I http://10.0.10.117:1313
* Rebuilt URL to: http://10.0.10.117:1313/
* Trying 10.0.10.117...
* TCP_NODELAY set
* Connected to 10.0.10.117 (10.0.10.117) port 1313 (#0)
> HEAD / HTTP/1.1
> Host: 10.0.10.117:1313
> User-Agent: curl/7.54.0
> Accept: */*
>
* Empty reply from server
* Connection #0 to host 10.0.10.117 left intact
curl: (52) Empty reply from server
There are no firewalls or network settings blocking Hugo, as running a simple Python server on the same port works just fine:
$ python -m SimpleHTTPServer 1313
Serving HTTP on 0.0.0.0 port 1313 …
$ curl -I http://10.0.10.117:1313
HTTP/1.0 200 OK
Server: SimpleHTTP/0.6 Python/2.7.10
Date: Sat, 01 Jun 2019 11:48:29 GMT
Content-type: text/html
Content-Length: 263
Last-Modified: Thu, 23 May 2019 18:58:43 GMT
I don’t know how to debug this any further, and I have not been able to find any relevant posts here or on GitHub, so any help is highly appreciated!
Edit: Binding to 0.0.0.0
makes the website available on localhost
and 0.0.0.0
, but not on the local IP.
Hugo version: Hugo Static Site Generator v0.55.6/extended darwin/amd64 BuildDate: unknown