Discourse on subdomain

(Rahul Banker) #1

I have wordpress installed on my home domain but when I try to install discourse on subdomain, it gives an error :

Error response from daemon: Cannot start container fb9c01b252976b52f3d8a2b30b303741e4c17f96d769af6a2d21a9c8cdd65f54: failed to create endpoint app on network bridge: Error starting userland proxy: listen tcp bind: address already in use

Can I have both installed on my single digitalocean droplet?

(Jason Crenshaw) #2

Discourse runs in a Docker container typically and uses Nginx to serve the application to the front end through port 80.
The error you’re getting is telling you that port 80 is already in use by another application. (In this case, likely being the Apache server that’s used to serve up Wordpress.)
You’ll need to serve up either Wordpress or Discourse to another port, then use either Apache or Nginx to reverse proxy that app back to the subdomain on port 80 again.

Attached are some resources passed to me today actually related to this topic:


Hopefully what you’re looking for is just around the corner with this added information.

(Rahul Banker) #3

thank you! working on it now

(Jason Crenshaw) #4

Just passing it forward. I had a hair pulling time today myself trying to get apache and discourse to play nicely on a server and talking through it with a few devops wizzes did wonders. A couple of those resources came from them.

I figured that with the amount of time and energy I spent on it already, the least I could do was save you some of the headache.

Let me know if you run into any complications and I’ll assist where I can.

(Disclaimer, I’m still very new to all this, so while I’ve gone through a number of the steps already, my knowledge in this department comes from limited experience and very little understanding, but I’ll help where I can.)

(Rahul Banker) #5

not a problem, just wanted to ask : did you run the above guide before installing anything or you installed discourse first and then installed the above guide?

(Jason Crenshaw) #6

My case is/was different.
I already had Discourse running and working on the server, but wanted a basic Apache server running so that I could serve up PHP content as I wished directly to the main domain name.

Since Discourse was served up on port 80, I made this change in the app.yml file:

  - "80:80"   # fwd host port 80   to container port 80 (http)

Changed to

  - "85:80"   # fwd host port 80   to container port 80 (http)

This makes Discourse serve to port 85 rather than 80.

I then installed apache2 and php5 on the server and configured it to run on port 80 from the main domain.

I’m now in the process myself of fine-tuning everything so that discourse is reverse proxied to the subdomain.

(Rahul Banker) #7

would you please mind posting your further findings? :slight_smile: that would be a great help!

(Jason Crenshaw) #8

I’m afraid what you have there is probably as far as I can really assist without knowing more about your server and the configuration. (kernel, apache, mods, docker, etc.)

I’m already making assumptions about your server that may or may not be correct.

To be more clear, I’m not telling you how to get what you want to happen done. I’m simply pointing you in the right direction. (Helping you to know the right question to ask since “wordpress + discourse” is a rather ambiguous question.)

Yes, you can have both on the same server. No, you’re not gonna be able to use both webservers on port 80. What you really should be looking for, is a way to serve up one app on the subdomain, and serve up the other on the parent domain. Your best bet is to configure this directly with Nginx or Apache. Since your site is Wordpress first, you may want to use Apache to handle this.

In summary: Nginx and Apache are both trying to listen on port 80 and they can’t both do that. Have one listen on another port, then proxy that connection through the subdomain to the client. How you decide to handle that is up to you, but will depend a lot on your specific situation, current configuration, VPS instance and preferences.

(Felix Freiberger) #9

There’s a tutorial on how to do this here on Meta:

(Rahul Banker) #10

I simply made 2 droplets on digitalocean and boom! :slight_smile: