[Solved] Hugo server port

Hello,

did something change with the 0.31 concerning the port hugo server listens on ?
It’s not binding on 1313 anymore but on random port.
I tried using -p 1313 to force it, but still doesn’t work.

I’m using : /usr/bin/hugo server --source /home/hugo -b https://myurl/ --canonifyURLs --log --logFile /home/hugo/logs/hugo.log --appendPort=false (--port 1313)

Actually the site works on the new dynamic port, but I’d like to make the port static as I have a reverse proxy in front of it.

Regards,

0.31 introduces possible multiple HTTP servers – but I have tested it on enough “single sites” to verify that it should work as normal in the normal case. We do, however, pick an available port if 1313 is in use.

@bep, thanks for the info, but I don’t get why it’s failing for me, because in my case port 1313 is not in use. I stopped the server before starting the new one.
I got to look at it more closely tonight.

I confirm it’s working for me, both in multilingual multi-host mode and the usual mode, specifying at the CLI.

Hugo Static Site Generator v0.32-DEV-42FBF15F darwin/amd64 BuildDate: 2017-11-20T20:00:20+09:00
GOOS="darwin"
GOARCH="amd64"
GOVERSION="go1.9.2"

Note that if this works for you in 0.30 and fails in 0.31, then it is obviously related to the recent changes – but I having troubles seeing exactly what.

Fwiw you can check a port’s usage on Mac with lsof. E.g. for 1313:

lsof -i :1313

I started a hugo on 1314, then started another one on the same port. I get:

Error: Server startup failed: listen tcp 127.0.0.1:1314: bind: address already in use

@RickCogley : thanks for investigating, actually I don’t have this message, it just starts on another port.

@bep : yes it was working in 0.30.2.

Hmm it could be related to this, the package is built on copr. Maybe it’s due to the go version not being 1.9 ? I’ll try with the official amd64 release.

$ hugo env
Hugo Static Site Generator v0.31 linux/amd64 BuildDate: 0001-01-01T00:00:00Z
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.8.3"

Anyway, no big deal, it just for a personnal blog.

The thing is, if it fails for you, chances are good it fails for many. So it would be good to figure out the what. If you could share the blog source somehow with me, I could try to take it for a spin.

@bep I tried with the release from github, it’s the same thing.
I sent you the blog code.

Solved with Hugo v0.31.1 !