Running other websites on the same machine as Discourse

(Ian Lawrence) #159


force https system setting in the admin did it
thx a lot

(Kane York) #160

X-Forwarded-Proto: https is what Discourse needs to properly auto-detect this @Ian_Lawrence


I can’t seem to get this to work. I run into this problem. Is anyone able to help me out?


My nginx.conf looks like this:

server {
    listen 80; listen [::]:80;

    return 301 https://$host$request_uri;

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    ssl 					on;
	include     			/etc/nginx/confs/nginx-ssl.conf;
	ssl_session_tickets 	off;

    location / {
        proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;

My docker-compose looks like this:

version: "3"

  image: sickp/alpine-nginx:1.13.0-r1
  container_name: nginx
    - "443:443"
    - "80:80"
    - plexnet
    - PUID=1000
    - PGID=1000
    - ${CONFIG_FOLDER}/nginx/nginx.conf:/etc/nginx/nginx.conf
    - ${CONFIG_FOLDER}/nginx/www:/etc/nginx/www
    # Configs
    - ${CONFIG_FOLDER}/nginx/confs:/etc/nginx/confs:ro
    # Discourse websocket
    - /var/discourse/:/var/discourse/
    # SSL
    - ${CONFIG_FOLDER}/nginx/dhparam.pem:/etc/nginx/dhparam.pem:ro
    - /etc/letsencrypt:/etc/letsencrypt:ro

    driver: bridge

The nginx.http.sock is available in my nginx container but I can’t seem to get the discourse welcome page. :frowning: Could someone please help me out?

(Joshua Rosenfeld) #166

Why do you have a docker-compose file? What method did you use to install Discourse? Following the official install guide you should not need docker-compose.


I have multiple containers running where I need to change things all the time. I also have nginx already running as part of my setup, therefor I prefer to stick to docker-compose. The above just has the relevant parts.

I followed the official guide along with this topic because of my setup. Discourse is running succesfully.


I find the discourse installation very complicated as soon as the the requirements slightly diverge from a default installation. There is hardly any documentation. All I have is a readme installation guide on Github and this topic. I must be missing something.

I can work my way around Docker and a unix system, but I honestly don’t understand what I’m doing wrong here. I just have my set of containers allready running and want to integrate Discourse. I don’t think that’s asking much.

(Jay Pfaffman) #169

What you want to do in English is put discourse in a non standard port (8888)and then configure your nginx to reverse proxy to it.

There are a zillion ways to do that, so it’s hard to account for the one that makes most sense for you.


That is what I thought. But my nginx container cant talk to the Discourse container. I assume that’s because my nginx (amongst other containers) are running in a separate bridged network. That’s where I assumed the websocket came in play. But nginx just isn’t communicating with the nginx.http.sock at all. Even though I’m running it as stated in the first post here.


I managed to make it work. Solution is in the topic I made a couple days ago.

(Amr0d) #172

Does this tutorial also apply if I have a server that runs Apache instead of nginx?

I am pretty much new to Discourse and I run a vserver with Ubuntu Linux to host a handful of websites but they all run with Apache. Now I wanted to add a new forum running the discourse docker but it looks like it isn’t as easy as I thought.

From what I have read so far I have to change ports in the app,yml and then use something like HAProxy to redirect ports for Discourse…right?

(Matt Palmer) #173

Most of the config, and all of the concepts, still apply. I’m pretty sure there’s posts on how to “frontend” Discourse with Apache on meta somewhere.

(Tumi) #174

what does mean exactly/

(Dog2puppy) #175

How would I setup another site to make to go to a apache server I have running on port 8181? I’ve never used nginx before, so I really don’t understand this.

(Luis Guzman) #176

In case you get An unexpected TLS packet was received errors


ssl_session_tickets off;

That worked out.

(Sam Saffron) #177

This really should not happen in any modern browser, if you disable this resuming SSL sessions will take longer.

(Luis Guzman) #178

If enabled, then there is not even a website to resume session from.
Not sure why to others it worked out well, since the system is a pretty standard *buntu 16.04 with nginx (PPA).

AFAIK, nginx doesn’t have modules to enable as apache, so I don’t think is that.

Edit: Browsers: Firefox/Chrome latest release - desktop and mobile.

Thanks for pointing this out.

(Timothy Vail) #179

Hello, I am trying to run wordpress alongside discourse on the same AWS server EC2

I followed some of this guide, and part of this guide until step 7

But when I load up my ip that the server is on, it goes to 404 error, how do I fix it?

I have the server_name as my ip, plus a domain I have connected to the ip.