# Hosting Discourse on a busy server - double Nginx (2024-08-27)

**URL:** <https://pluralist.net/t/hosting-discourse-on-a-busy-server-double-nginx-2024-08-27/189>\
**Category:** breadcrumbs\
**Created:** [August 28, 2024, 5:49am UTC](https://pluralist.net/t/hosting-discourse-on-a-busy-server-double-nginx-2024-08-27/189 "2024-08-28T05:49:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![delyan](https://pluralist.net/user_avatar/pluralist.net/delyan/32/245_2.png) [@delyan](https://pluralist.net/u/delyan)\
**Post date:** [August 28, 2024, 5:49am UTC](https://pluralist.net/t/hosting-discourse-on-a-busy-server-double-nginx-2024-08-27/189/1 "2024-08-28T05:49:33Z")

</div>

1. Double nginx idea: [Run other websites on the same machine as Discourse - #269 by sam - Self-Hosting - Discourse Meta](https://meta.discourse.org/t/run-other-websites-on-the-same-machine-as-discourse/17247/269)
2. add the nginx stream module: [unknown directive "stream" in /etc/nginx/nginx.conf:86 - Server Fault](https://serverfault.com/questions/858067/unknown-directive-stream-in-etc-nginx-nginx-conf86)
3. Configure discourse: edit /var/discourse/containers/app.yml

```auto
## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
expose:
  - "3001:80" # http
  - "3002:443" # https

```

1. Edit /etc/nginx/nginx.conf

```auto
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

stream {
    upstream backend {
        server 127.0.0.1:3002;
    }

    server {
        listen 443;
        proxy_pass backend;
    }
}

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    gzip on;
}

```
