Discourse + web server. Possible or better to avoid?

Quick disclaimer: I’m relatively new to building a VPS environment from scratch but have enough experience with web hosting (specifically shared and managed-dedi) to have an idea what I am doing and make sense of tutorials.

That said, I’m currently using DigitalOcean’s cheapest droplet for experimentation. I’m a hobbyist, don’t expect to have a ton of traffic, and am just trying to create two instances that will offer a frontpage of some sort (likely WordPress) and an accompanying Discourse forum — one instance for game design and another for my content creator community.

I’m aware that Discourse and Apache don’t blend well together because of Discourse’s decision to use port 80 and I’m also aware that there are workarounds but there appears to be varying forms with unconfirmed results and no official “yeah this works” from Discourse.

I’m a little confused as to why such an amazing platform has been designed to be so obstructive to managing a web server alongside it but my experience with the software thus far has me interested enough to find a way to make it work. I’ve seen that a WordPress integration exists and it’s hyped on a feature page but again, Discourse seemingly isn’t designed to be anything but standalone.

Any advice or input from those who’ve run into the same predicament? Thanks!

I think this is what you’re looking for:

@neounix has some experience with running Discourse w/ apache2 so they may be able to give some pointers.

4 Likes

Is this a recommendation to switch to Nginx then? I have absolutely no experience with it and any web server I’ve ever used, preconfigured included, has used Apache.

There’s also this for Apache: How to set up Discourse on a server with existing Apache sites

However, there appears to be a large number of issues getting it to work properly, particularly with SSL.

Would it be simpler to run two droplets, one for the website and one specifically for Discourse? I suppose I could just change the DNS record for the subdomain to point to the Discourse droplet and that should resolve the issue. Just find it odd to run two servers for a forum.

Hi @OrbitStorm

Welcome!

Discourse is not obstructive at all.

Mastering running Dockerized Discourse behind a reverse proxy web server is a very rewarding experience; either using Apache2 or nginix.

If you are already running apps behind Apache it is easy to set up one or even 100 Dockerized Discourse instances behind Apache!

5 Likes

Appreciate the response.

I say this with the utmost respect but Discourse, out of the box, effectively requires its own server. Using a reverse proxy to run a web server parallel to Discourse on the same VPS is hit or miss, as evidenced by the comments and other complaints, and SSL may or may not work. It’s also virtually impossible to get two instances of Discourse on the same server. All of that, to me, is obstructive. There’s no other forum software, including high-end platforms like XenForo or Invision, that requires that level of effort with that amount of uncertainty. They’re expensive packages so I suppose you’re getting what you don’t pay for with Discourse. As a new user looking at all of these hurdles, it just seems as though Discourse was designed with nothing else in mind (i.e. websites).

For what it’s worth, as noted in my original post, I used a one-click deployment for Discourse. So, I’ll need to do everything in reverse to try and get Apache (or Nginx if I can’t find a tutorial) on the same server. If I’m going to use Discourse as my primary forum platform, I’m not interested in running two servers for one community. That’s just silly.

I honestly think it’s doable, i’m no expert and “just” follow the very good guides and tutorials here and there, I had little to no problem setting up discourse behind nginx, so I’m probably a bit lucky but I think it’s far from impossible :slightly_smiling_face:
I like these :



Thought it might not be an easy road to add to the mix multisite/multicontainer and s3 clone :sweat_smile:

and for the combo postfix/dovecot

1 Like

@Benjamin_D The issue I have is that all of the tutorials available here are missing some aspect of my current environment. There is a tutorial for Apache but using CentOS. I use Ubuntu. The other tutorial by Kane York uses Nginx but as I mentioned, I use Apache.

I’m not doing anything overly complex either. I’m just using DigitalOcean, Linux + Ubuntu 18.04, hosting everything on the droplet (not using third-party storage), etc. I am using Mailgun as a mail solution but I don’t believe that offers an inbox which is fine for the time being.

Just trying to make it as simple as possible.

1 Like

@OrbitStorm

Actually, Discourse is the finest forum and community building open source software on the planet at the present time (IMHO), for many reasons, here are but a few:

  1. Discourse is open source and has a strong community and very smart (and capable) core dev team.

  2. Discourse is designed to run in a Docker container in production, which has many benefits:

  • Discourse can be easily deployed in standalone mode without any need for an external web server or database.

  • Discourse can be easily deployed in multi-container mode providing more reliability and seamless upgrades.

  • Discourse can also be deployed in very high availability configurations using Docker Swarm and Kubernetes where Discourse can scale up and down “on demand”.

  • Discourse is easy to backup and restore. We can take the standard Discourse backup OOTB and restore anywhere in the world in a fresh, virgin Docker container.

  1. Discourse runs easily behind both Apache2 and nginx reverse web proxy servers. This also has many advantages, here are a few:
  • Discourse can run on an existing web server, be it nginix or Apache2, with little effort on both Docker exposed TCP/IP ports or UNIX domain sockets.

  • Running web-based apps behind reverse proxies are well established. This setup is not germane to Discourse, but Discourse will provide support.

  • Setting up SSL is very simple behind a reverse proxy and can be as simple as `certbot -d my.great-discourse.site’ using supported and free LETSENCRYPT.

  1. Discourse is fully documented, commit-by-commit, on GitHub, so anyone can follow along with code changes.

  2. Discourse has a progressive business model, which has some key benefits, including:

  • Discourse, the core software and many great plugins, themes and components, are free.

  • Discourse provide free support including standard configuration support, at meta.

  • Discourse provides commercial hosting to those who do not want to self-host or prefer to be more “hands off”.

  • Discourse encourages commercial consulting and plugin development in their community, creating a viable business ecosystem.

  1. There is more, but I want to wrap this up!

Do I (we) agree with every decision made by the core Discourse team and do they agree with all our (or my) ideas and suggestions?

No, of course not; and nor should they, or us, nor me. We are free to suggest, submit code suggestions, PRs, and the core Discourse team will approach these suggestions with an open mind.

But at the end of the day, the core team must keep the Discourse community moving in a cohesive direction, which is not easy when 100s of people from different cultures want a different configuration and have different priorities, business models and ideas.

In other words, there is nothing to “avoid” (your topic title words) from Discourse, especially setting up reverse proxies and mastering Docker. Many (include me) are moving into Kuberetes because of Discourse, not only for Discourse but for other web apps as well.

Discourse is the “furthest thing” from “obstructive” (again, your words, not mine); and because it is based on containers, by design, the “sky is the limit” to how experienced system admins can deploy Discourse in highly scaleable production envs; and it is also simple enough that beginners can easily deploy in standalone mode.

Need I say more?

As the REM song (Losing My Religion) goes:

Oh no, I’ve said too much, I set it up

Signing off this topic… Best of Luck @OrbitStorm

2 Likes

If i understand correctly, what you want is nginx listening and redirecting one subdomain to apache on one side and one subdomain to the container where discourse is on the other side (setup by exposing the right port in the app.yml, or using the web.socketed template), or are you using apache as a proxy?

Nginx is used instead of HAproxy in the CentOS tutorial, I think :thinking:

Close but no. To reiterate, I’m on Linux + Ubuntu 18.04. I’m using Apache to serve up a standard HTML website (WordPress in the future) and have Discourse installed under a subdomain. I just need to figure out how to set up a reverse proxy (per these tutorials) that will redirect traffic from ports 80 and 443 to new ports since Apache uses both of those ports already. I’m not interested in using Nginx because I have no experience with it and don’t want to bundle it with Apache and make my setup even more complex.

I’m not an advanced developer. I’m just a guy with a fluent understanding of the frontend, basic understanding of panels, limited understanding of SSH, and basically no understanding of everything else (which is why I’m using tutorials).

My end goal is to have two domains with a respective frontpage and with multiple instances of Discourse (one for each website). Simple stuff.

1 Like

Not sure if it’s more complex to use apache as a server and a proxy than bundling nginx or HAproxy :sweat_smile:
About the tutorial, CentOS or Ubuntu shouldn’t make a lot of differences, apt instead of yum ,
https://support.cloudflare.com/hc/en-us/articles/360029696071-Restoring-original-visitor-IPs-Option-2-Installing-mod-remoteip-with-Apache instead of

may I suggest this for apache as a reverse proxy

1 Like

If you want your life to be easy then run discourse on its own droplet. You really can’t run discourse and apache on a 1gb droplet, so two 1gb droplets doesn’t even cost more.

2 Likes

@pfaffman My intention was never to stay on the smallest droplet, I’m just using it while I try to get everything configured. No sense in paying a greater hourly rate while experimenting.

Only reason I’m not so keen on running two droplets is because I’ll likely have 3-4 different domains to migrate to DigitalOcean. I don’t want to be paying for 6-8 droplets. That’s insanity.

If your want more that 3 discourse sites then You likely want to figure out multisite. I have a configuration that I do with traefik,though I’m investigating other reverse proxies.

If you are using Apache and you want multiple discrete sites, the relevant search term is VirtualHost.

4 Likes

With a small droplet, you may want to reduced the buffers. My droplet has 4GB mem and 4 shared cores.

2 Likes

Was able to come up with a solution thanks to Bobbyiliev from DigitalOcean.

You can find that solution here: Discourse not loading with Apache and proxy redirect

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.