Nginx + discourse

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

## 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?

3 Likes

You might want to take a look at this post for more information:

Haven’t done it myself, but looks pretty detailed and might send you in the right direction for your project.

1 Like

I’m aware of that, but I don’t think you’ve answered my question (your post also got cut off)

Do you see the above configuration as a possible working solution? Discourse is not yet installed and I plan on using the above app.xml to install it. The nginx should then act as a proxy.

If you don’t know, please say you don’t know. That is a perfectly acceptable answer.

1 Like

Post is not cut off, it is a summary generated from the link. Click through to view. Like any other link on the web…

You can also click on the top of the summary anywhere around the chevron arrow to expand it in place, rather than visiting the URL.

Alright, I missed that.

I decided to try my configuration anyways and answer my own question. The answer is YES it works using my configuration found in post #1

1 Like

Let us know what prior research you’ve done in the future so we can skip recommending anything you might have already seen.

See:

Do you mean app.yml ? From my linked article:

So, I would say that while your proposed app.yml file might work, it would not be the preferred/supported method of doing what you’re trying to accomplish.

I do apologize. I’m new to discourse and your post appeared to be cut off. So from my limited perspective it originally appeared to offer no information.

The only question I really was asking was if my config looked like it would work or if anyone else had tried such a configuration?!

I decided to proceed forward and my config does work. :slight_smile:

Understood, no hard feelings. Good luck with your setup. Do consider my warning though that while your method may work, you might encounter support issues that this community won’t be able to help you with because your setup is different than the one recommended by a Discourse team member.

1 Like

Seems like @honey knows what s/he is doing. Good work!

1 Like

Thanks @Honey!

Also, it is amazing how well Discourse is indexed on Google.

Kudos guys :sunny:

2 Likes

This topic was automatically closed after 3132 days. New replies are no longer allowed.