Discourse is one of the best platforms for forum and communities. The official installation, however, requires the entire server for herself. See how we run it next to Wordpress, behind Plesk, in a separate and isolated container.
The official Discourse team does not support installation on servers with Plesk, cPanel or other hosting panels. Discourse requires its own Docker environment and usually binds ports 80 and 443, which are already used by the Plesk web server (Apache/Nginx or IIS)
Discourse is installed with Docker and normally “grabs” ports 80 and 443. On a Plesk server, these ports are already used by Plesk’s nginx for all your sites. The solution is simple: Discourse runs inside its container and only listens internally (on port 8080), while Plesk stays in front, takes over the SSL certificate and forwards visits to the forum.
A major advantage of this architecture is security : the forum has its own database (PostgreSQL) and its own files inside the container. If it is ever compromised, the attacker will not have access to WordPress, its database, or its administrator passwords.
Note: The Discourse team officially supports only the standard installation. The reverse proxy method is “unsupported”, but it works perfectly for us.
What do you need?
- RAM: at least 2 GB for Discourse alone. If running WordPress, MySQL, and Plesk on the same server, expect 4 GB or more, including swap.
- Disk space: about 20 GB free to start with.
- A subdomain, for example forum.example.gr, and access its DNS.
- SMTP account for the mission EmailDiscourse does not work without email (account activation, notifications).
- Root access via SSH on the server.
Step 1: DNS, subdomain and certificate
- In DNS (e.g. in Cloudflare we use) add a record A with a forum name pointing to the server IP. If you are using Cloudflare, set it initially as DNS only (gray cloud), so that the certificate can be issued.
- In Plesk: Websites & Domains → Add Subdomain and create forum.example.gr.
- In the subdomain, open SSL/TLS Certificates and issue a free certificate Let's Encrypt.
Step 2: Docker and Discourse
Install Docker, either from Plesk → Extensions → Docker or from SSH (in our case we installed it with SSH):
curl -fsSL https://get.docker.com | shDownload Discourse and create the configuration file:
git clone https://github.com/discourse/discourse_docker.git /var/discoursecd /var/discoursecp samples/standalone.yml containers/app.ymlThe two necessary changes to app.yml are made with commands, to avoid errors in the YAML. The first disables Discourse's SSL (Plesk takes care of that) and the second makes it only listen internally on port 8080:
cp containers/app.yml containers/app.yml.baksed -i 's|^\(\s*\)- "templates/web.ssl.template.yml"|\1#- "templates/web.ssl.template.yml"|' containers/app.ymlsed -i 's|^\(\s*\)- "templates/web.letsencrypt.ssl.template.yml"|\1#- "templates/web.letsencrypt.ssl.template.yml"|' containers/app.ymlsed -i 's|- "80:80".*|- "127.0.0.1:8080:80"|' containers/app.ymlsed -i '/- "443:443"/d' containers/app.ymlThe 127.0.0.1:8080 setting is important for security: Discourse is not directly accessible from the internet and Docker cannot open a port “over” your firewall.
Then open the file with nano containers/app.yml and fill in your own values (keep exactly the two spaces at the beginning of each line):
DISCOURSE_HOSTNAME: 'forum.example.gr'
DISCOURSE_DEVELOPER_EMAILS: 'admin@example.gr'
DISCOURSE_SMTP_ADDRESS: smtp.example.com
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: user@example.gr
DISCOURSE_SMTP_PASSWORD: "ο-κωδικός-σας"
DISCOURSE_SMTP_ENABLE_START_TLS: true
DISCOURSE_SMTP_DOMAIN: example.gr
DISCOURSE_NOTIFICATION_EMAIL: noreply@example.grThe file contains the SMTP password, so lock it so that only root can read it, and start the installation (10–15 minutes):
chmod 600 containers/app.yml containers/app.yml.bak./launcher rebuild appcurl -sI http://127.0.0.1:8080 | head -1If the last command shows HTTP/1.1 200 OK , Discourse is running.
Step 3: Plesk as a reverse proxy
In Plesk, in the forum subdomain, open Apache & nginx Settings . Uncheck "Proxy mode" (otherwise the requests go to Apache, which knows nothing about Discourse, and you see a 502 error). In the Additional nginx directives field add:
location ~ ^/(?!\.well-known/acme-challenge/) {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Connection "";
proxy_set_header X-Real-IP $http_cf_connecting_ip;
proxy_set_header X-Forwarded-For $http_cf_connecting_ip;
proxy_set_header X-Forwarded-Proto https;
client_max_body_size 20m;
proxy_read_timeout 300;
}The regex format avoids the “duplicate location” error with Plesk settings and leaves the Let's Encrypt path in Plesk so the certificate renews properly. The cf_connecting_ip headers pass the visitor's real IP to Discourse when using Cloudflare.
Step 4: Cloudflare
- Turn forum registration on Proxyed (orange cloud) and keep SSL on Full (strict).
- Turn it off Rocket Loader for the forum: Rules → Configuration Rules, hostname forum.example.gr → Rocket Loader offDiscourse JavaScript is broken.
Step 5: First boot and administrator
Open the forum and register with the email you provided in DISCOURSE_DEVELOPER_EMAILS. If the activation email has not yet arrived, you can activate your account directly from the server . Note the single quotes outside the command: with double quotes, bash interprets the ! and outputs “event not found”.
cd /var/discourse./launcher enter apprails runner 'u = User.find_by_email("admin@example.gr"); u.activate; u.grant_admin!; puts u.username'exitIn Admin → Settings , enable force https and enforce second factor: staff , so that all administrators have mandatory two-step verification.
Email: the most common trap
From Admin → Emails → Send test email you can immediately see the mail server's response. The most common errors:
| Error | Cause and solution |
| enable_starttls_auto: false | DISCOURSE_SMTP_ENABLE_START_TLS is missing or commented out with #. For port 587 it must be true. |
| Connection failure with STARTTLS and FORCE_TLS | DISCOURSE_SMTP_FORCE_TLS is for port 465. With port 587 remove it. |
| 535-5.7.8 Username and Password not accepted | Gmail doesn't accept the regular password: it requires an App Password, which requires two-step verification. In Google Workspace, the administrator can block it. |
You can check the SMTP details directly from the server, without Discourse: if the response contains 235, the code is correct.
curl -v --url 'smtp://smtp.gmail.com:587' --ssl-reqd \
--mail-from 'user@example.gr' --mail-rcpt 'user@example.gr' \
--user 'user@example.gr:APPPASSWORD' \
-T <(printf 'Subject: test\n\nok\n') 2>&1 | grep -E '235|535'After each change to app.yml you need to ./launcher rebuild app again. For a forum with traffic, a transactional email service (Brevo, Mailgun, Amazon SES) is more reliable than Gmail, which has sending limits. Don't forget SPF, DKIM and DMARC records in DNS, otherwise emails end up in spam.
Other problems you will encounter
| Symptom | What it means |
| 502 Bad Gateway | Plesk cannot find Discourse: the container is not running (./launcher start app), "Proxy mode" is active, or the nginx settings were not saved. |
| SSL certificate problem: self-signed | Plesk still serves the default certificate: issue Let's Encrypt for the subdomain. |
| expose:: command not found | You wrote lines of YAML in the terminal. They belong inside the app.yml file. |
| Preview in Plesk shows error | It is often an old snapshot. Check with curl -sI https://forum.example.gr. |
Maintenance and backups
- Updates: by Admin → Upgrade Or with ./launcher rebuild appAfter the rebuilds, the ./launcher cleanup frees up space.
- Backups: Discourse keeps daily backups in /var/discourse/shared/standalone/backups/. Plesk backups not include this folder, so send them off-server as well (S3 or rsync).
- One firewall, not two: If you have both ufw and the Plesk Firewall, keep only one, so that one does not alter the rules of the other.
That was it: a full, fast forum on the same server as WordPress, but in a completely separate space. In the next article we will see how we connect it to WordPress, so that articles become discussions and replies appear below each article.





0 reviews
iGuRu.gr