Question about using Hugo server with Nginx

Hi, I am trying to use Nginx to proxy my Hugo server. I am creating a proxy_pass at which I think should be equivalent to where my Hugo server is serving from, localhost:1313. However, I am getting a bad gateway. All of my other proxies are working, and when I use netcat to check port 1313, it receives a GET request from Nginx. Additionally, when I use sudo lsof -i | grep LISTEN to check ports in use, I get the following info:
hugo 90595 david 273u IPv4 0xa422f17f5524c04d 0t0 TCP localhost:bmc_patroldb (LISTEN) . So it seems that hugo is actually listening at port 90595 rather than what I am expecting, 1313. I have tried running hugo server --port=1313 -appendPort=false as well. Can anyone explain to me what’s going on?

If you look in the log at startup, it probably says that “the port is in use … lets try another one …” or something like that.

But why are you using nginx AND Hugo’s server? nginx should be able to serve static files? Sounds much simpler to me.

Like @bep said, I wouldn’t recommend using hugo server in production. Just build the site in a dir (say /opt/www/mysite) and put this in an nginx config:

server {
  root /opt/www/mysite/public;