# Question about using Hugo server with Nginx

**URL:** <https://discourse.gohugo.io/t/question-about-using-hugo-server-with-nginx/2466>\
**Category:** support\
**Created:** [January 14, 2016, 7:11pm UTC](https://discourse.gohugo.io/t/question-about-using-hugo-server-with-nginx/2466 "2016-01-14T19:11:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dammo001](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@dammo001](https://discourse.gohugo.io/u/dammo001)\
**Post date:** [January 14, 2016, 7:11pm UTC](https://discourse.gohugo.io/t/question-about-using-hugo-server-with-nginx/2466/1 "2016-01-14T19:11:54Z")

</div>

Hi, I am trying to use Nginx to proxy my Hugo server. I am creating a proxy\_pass at 192.168.33.1:1313 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?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [January 14, 2016, 7:24pm UTC](https://discourse.gohugo.io/t/question-about-using-hugo-server-with-nginx/2466/2 "2016-01-14T19:24:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![minhajuddin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/minhajuddin/32/1102_2.png) [@minhajuddin](https://discourse.gohugo.io/u/minhajuddin)\
**Post date:** [January 15, 2016, 9:09am UTC](https://discourse.gohugo.io/t/question-about-using-hugo-server-with-nginx/2466/3 "2016-01-15T09:09:45Z")

</div>

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:

```auto
#/etc/nginx/conf.d/mysite.conf
server {
  server_name mysite.com;
  root /opt/www/mysite/public;
}

```
