Today, when setting up a Discourse forum on my own server, I encountered a problem: the server already had other web services occupying port 80. After some searching and experimenting, I finally found a concise and effective solution in the comments section of the official forum. I’m sharing my setup process below in hopes it will help anyone facing the same issue.
Problem Background
Following the official standard installation steps:
git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
chmod 700 containers
./discourse-setup
However, since port 80 was already in use, the installation couldn’t continue.
Solution (from the official forum)
-
Clone the Discourse repository (as per the official instructions)
git clone https://github.com/discourse/discourse_docker.git /var/discourse -
Copy the configuration file
cp /var/discourse/samples/standalone.yml /var/discourse/containers/app.yml -
Edit the app.yml file, making the following key changes:
DISCOURSE_HOSTNAME: 'domain.net' DISCOURSE_DEVELOPER_EMAILS: '[email protected],[email protected]' DISCOURSE_SMTP_ADDRESS: smtp.mail.me.com DISCOURSE_SMTP_PORT: 587 DISCOURSE_SMTP_USER_NAME: [email protected] DISCOURSE_SMTP_PASSWORD: "safe-code-safe-code" DISCOURSE_NOTIFICATION_EMAIL: [email protected] DISCOURSE_SMTP_AUTHENTICATION: login -
Adjust port configuration:
- Comment out 443:443 (since you’ll use nginx for reverse proxy, there’s no need to expose port 443)
- Change 80:80 to 8001:80 (8001 can be replaced with any available port you like)
-
Rebuild the app
./launcher rebuild app -
Set up port forwarding on nginx, then simply access the domain and register the initial account
Notes
-
SMTP settings are crucial—be sure to fill in the correct email service information, or user registration and notification features won’t work properly.
-
After changing the port, remember to set up reverse proxy rules in nginx or your web server, pointing the specific domain to port 8001.
-
If emails can’t be sent, use the built-in diagnostic tool to troubleshoot.
./discourse-doctor
The whole process takes just a few minutes. Discourse will automatically download the required images and complete the configuration. Once installation is done, you can access your forum through your domain name.
Like they say, wisdom comes from the community! This solution is more flexible than the method described in the official documentation, especially suitable for server environments that already have web services running.