# Discourse + web server. Possible or better to avoid?

**URL:** https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489
**Category:** Self-hosting
**Created:** [July 12, 2020, 4:58am UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489 "2020-07-12T04:58:11Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![OrbitStorm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orbitstorm/32/186582_2.png) [@OrbitStorm](https://meta.discourse.org/u/OrbitStorm)
#### Post date: [July 12, 2020, 4:58am UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/1 "2020-07-12T04:58:11Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [July 12, 2020, 5:18am UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/2 "2020-07-12T05:18:35Z")

</div>

I think this is what you’re looking for:

> [@Run other websites on the same machine as Discourse](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247):
>
> @pfaffman edited this heavily 2022.02.24. Blame me if it’s broken. If you want to run other websites on the same machine as Discourse, you need to set up an extra NGINX or HAProxy proxy in front of the Docker container. NOTE: This is for advanced admins This guide assumes you already have Discourse working - if you don’t, it may be hard to tell whether or not the configuration is working. You cannot use ./discourse-setup to set up Discourse if another server is using port 80 or 443. You will…

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

---

<div class="post-metadata">

### Author: ![OrbitStorm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orbitstorm/32/186582_2.png) [@OrbitStorm](https://meta.discourse.org/u/OrbitStorm)
#### Post date: [July 12, 2020, 6:49am UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/3 "2020-07-12T06:49:39Z")

</div>

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: [Set up Discourse on a server with existing Apache sites](https://meta.discourse.org/t/how-to-set-up-discourse-on-a-server-with-existing-apache-sites/30013)

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.

---

<div class="post-metadata">

### Author: ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)
#### Post date: [July 12, 2020, 8:45am UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/4 "2020-07-12T08:45:52Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![OrbitStorm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orbitstorm/32/186582_2.png) [@OrbitStorm](https://meta.discourse.org/u/OrbitStorm)
#### Post date: [July 12, 2020, 10:17am UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/5 "2020-07-12T10:17:35Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)
#### Post date: [July 12, 2020, 12:19pm UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/6 "2020-07-12T12:19:23Z")

</div>

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 🙂  
I like these :  
[https://linuxize.com/post/how-to-install-nginx-on-ubuntu-18-04/](https://linuxize.com/post/how-to-install-nginx-on-ubuntu-18-04/)  
[https://linuxize.com/post/secure-nginx-with-let-s-encrypt-on-ubuntu-18-04/](https://linuxize.com/post/secure-nginx-with-let-s-encrypt-on-ubuntu-18-04/)  
Thought it might not be an easy road to add to the mix multisite/multicontainer and s3 clone 😅

and for the combo postfix/dovecot  
[https://linuxize.com/post/install-and-configure-postfix-and-dovecot/](https://linuxize.com/post/install-and-configure-postfix-and-dovecot/)

---

<div class="post-metadata">

### Author: ![OrbitStorm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orbitstorm/32/186582_2.png) [@OrbitStorm](https://meta.discourse.org/u/OrbitStorm)
#### Post date: [July 12, 2020, 12:25pm UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/7 "2020-07-12T12:25:28Z")

</div>

@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.

---

<div class="post-metadata">

### Author: ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)
#### Post date: [July 12, 2020, 12:44pm UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/8 "2020-07-12T12:44:29Z")

</div>

@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

---

<div class="post-metadata">

### Author: ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)
#### Post date: [July 12, 2020, 12:47pm UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/9 "2020-07-12T12:47:18Z")

</div>

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 🤔

> [@Set up Discourse on a server with existing Apache sites](https://meta.discourse.org/t/set-up-discourse-on-a-server-with-existing-apache-sites/30013/1):
>
> - Install HAProxy (or an **alternative** ) which will take over port 80 and then divert your Discourse traffic to your docker container, and all your other sites to your usual Apache set-up.
> - Let Apache know which port to listen for.

---

<div class="post-metadata">

### Author: ![OrbitStorm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orbitstorm/32/186582_2.png) [@OrbitStorm](https://meta.discourse.org/u/OrbitStorm)
#### Post date: [July 12, 2020, 12:53pm UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/10 "2020-07-12T12:53:23Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)
#### Post date: [July 12, 2020, 1:54pm UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/11 "2020-07-12T13:54:39Z")

</div>

Not sure if it’s more complex to use apache as a server and a proxy than bundling nginx or HAproxy 😅  
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](https://support.cloudflare.com/hc/en-us/articles/360029696071-Restoring-original-visitor-IPs-Option-2-Installing-mod-remoteip-with-Apache) instead of

> [@Set up Discourse on a server with existing Apache sites](https://meta.discourse.org/t/set-up-discourse-on-a-server-with-existing-apache-sites/30013/1):
>
> For Centos 7, use: [mod\_remoteip - Apache HTTP Server Version 2.5](http://httpd.apache.org/docs/trunk/mod/mod_remoteip.html)

may I suggest this for apache as a reverse proxy

> [@Discourse behind reverse proxy and https](https://meta.discourse.org/t/discourse-behind-reverse-proxy-and-https/148705/3):
>
> I got Apache2 working “no problem” in a test bed with Apache2 as a reverse proxy to a unix socket in the container: The only difference I found (note: only a few hours of testing, nothing complete) was: Apache2 will not work with with a symlink to the unix socket in the shared volume in the container; Apache2 was a bit slower in a rough test, but not by much. Personally, I’m not a fan of religious wars over technologies; so I disagree that “Apache2 will give you a lot of issues.” I did n…

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [July 12, 2020, 9:03pm UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/12 "2020-07-12T21:03:51Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![OrbitStorm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orbitstorm/32/186582_2.png) [@OrbitStorm](https://meta.discourse.org/u/OrbitStorm)
#### Post date: [July 12, 2020, 10:11pm UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/13 "2020-07-12T22:11:04Z")

</div>

@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.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [July 13, 2020, 2:23am UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/14 "2020-07-13T02:23:16Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![schleifer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schleifer/32/86416_2.png) [@schleifer](https://meta.discourse.org/u/schleifer)
#### Post date: [July 13, 2020, 10:34am UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/15 "2020-07-13T10:34:39Z")

</div>

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

> [@How to run Discourse as an Apache VirtualHost](https://meta.discourse.org/t/how-to-run-discourse-as-an-apache-virtualhost/154707):
>
> I’ve successfully been able to install Discourse on my server, register as the first user, and post my first topic. So everything on the Discourse side of things seems to be working. However, in order to get Discourse installed and running, I had to disable my Apache httpd daemon. This is a major problem for me as I’ve basically shutdown my entire web server, which includes a bunch of domains as well as a Jitsi conference server. My Jitsi installation runs as a separate virtual host using a …

---

<div class="post-metadata">

### Author: ![nap](https://avatars.discourse-cdn.com/v4/letter/n/a87d85/32.png) [@nap](https://meta.discourse.org/u/nap)
#### Post date: [July 13, 2020, 11:13am UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/16 "2020-07-13T11:13:27Z")

</div>

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

> [@Discourse Bad Gateway after reboot](https://meta.discourse.org/t/discourse-bad-gateway-after-reboot/156446/16):
>
> I have one main 40G partition (14GB free), 512MB swap, and an 8GB partition for backups (not mounted).
> 
> It appears I have overcome the problem. Initially I tried reducing buffers to 2GB and workers to 4 but got the same error. I then reduced the buffers down to 1GB whereupon `rebuild` succeeded and the forum is now back up.

---

<div class="post-metadata">

### Author: ![OrbitStorm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orbitstorm/32/186582_2.png) [@OrbitStorm](https://meta.discourse.org/u/OrbitStorm)
#### Post date: [July 15, 2020, 10:51am UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/17 "2020-07-15T10:51:01Z")

</div>

Was able to come up with a solution thanks to [Bobbyiliev](https://www.digitalocean.com/community/users/bobbyiliev) from DigitalOcean.

You can find that solution here: [Discourse not loading with Apache and proxy redirect - #8 by OrbitStorm](https://meta.discourse.org/t/discourse-not-loading-with-apache-and-proxy-redirect/157512/8)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [August 14, 2020, 10:51am UTC](https://meta.discourse.org/t/discourse-web-server-possible-or-better-to-avoid/157489/18 "2020-08-14T10:51:16Z")

</div>

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