# Nginx + discourse

**URL:** <https://meta.discourse.org/t/nginx-discourse/35444>\
**Category:** Self-hosting\
**Created:** [November 11, 2015, 3:14am UTC](https://meta.discourse.org/t/nginx-discourse/35444 "2015-11-11T03:14:02Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Honey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/honey/32/122121_2.png) [@Honey](https://meta.discourse.org/u/Honey)\
**Post date:** [November 11, 2015, 3:14am UTC](https://meta.discourse.org/t/nginx-discourse/35444/1 "2015-11-11T03:14:03Z")

</div>

On my vps I use primarily nginx for a php type forum. I also am running NodeBB (node.js) proxied through nginx. The point being port 80 belongs to nginx. I believe this will work, but I’d like some feedback.

app.xml

```plaintext
## which TCP/IP ports should this container expose?
expose:
  - "81:80" # fwd host port 80 to container port 80 (http)
  - "2222:22" # fwd host port 2222 to container port 22 (ssh)[/code]

nginx
[code]server {
    listen 80;

    server_name example.com;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://127.0.0.1:81/;
        proxy_redirect off;

        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}
```

Thoughts?

---

_[View the full topic](https://meta.discourse.org/t/nginx-discourse/35444)._
