By dashan
I want to confirm the operation process. First, connect to my server and complete the corresponding steps according to the discourse prompt. Then, if you cannot access the website, you need to download nginx or apache (download any one). I installed nginx according to this operation but an error occurred. What should I do next?
https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04
root@discourse:~# sudo ufw allow ‘Nginx HTTP’
Rule added
Rule added (v6)
root@discourse:~# sudo ufw allow ‘Nginx HTTPS’
Rule added
Rule added (v6)
root@discourse:~# sudo ufw status
Status: active
To Action From
22/tcp LIMIT Anywhere
80/tcp ALLOW Anywhere
443 ALLOW Anywhere
Nginx HTTP ALLOW Anywhere
Nginx HTTPS ALLOW Anywhere
22/tcp (v6) LIMIT Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
Nginx HTTP (v6) ALLOW Anywhere (v6)
Nginx HTTPS (v6) ALLOW Anywhere (v6)
root@discourse:~# systemctl status nginx
× nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset:>
Active: failed (Result: exit-code) since Wed 2025-09-24 19:41:30 UTC; 2min>
Docs: man:nginx(8)
CPU: 13ms
lines 1-5/5 (END)
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hey,
Looking at your output, nginx is failing to start. This is a common issue when Discourse is already using ports 80 and 443, which nginx also needs. Here’s how to diagnose and fix this:
sudo netstat -tlnp | grep ':80\|:443'
or
sudo ss -tlnp | grep ':80\|:443'
sudo journalctl -u nginx.service -l --no-pager
or
sudo tail -f /var/log/nginx/error.log
sudo docker ps
If Discourse is already running and using ports 80/443: You don’t actually need nginx! Discourse’s built-in reverse proxy handles this. Try accessing your site directly with your domain/IP.
If you still want to use nginx as a reverse proxy:
cd /var/discourse
sudo ./launcher stop app
sudo systemctl start nginx
sudo systemctl status nginx
Quick test - try accessing your site: Before making changes, try visiting your domain in a browser. If Discourse installed correctly, it might already be working without nginx.
What do you see when you run the diagnostic commands above? This will help determine the exact issue.
If you’re unable to access the Discourse URL after deployment, check the following:
DNS – Make sure your domain points to the server IP.
Firewall – Open ports 80 and 443.
Docker – Ensure the Discourse container is running.
SSL – Check for Let’s Encrypt or SSL issues.
app.yml – Verify the correct hostname is set.
Resources – Ensure the server has enough RAM and disk.
Logs – Run ./launcher logs app for error details.
Rebuild with:
cd /var/discourse
sudo ./launcher rebuild app
Heya, @dashan
There’s a misconfiguration or a port conflict.
You can run:
sudo journalctl -xeu nginx
That will show the error message that caused nginx to fail. Often it’s something like “bind() to 0.0.0.0:80 failed” if another process is already using port 80.
Run:
sudo nginx -t
If there’s a typo or bad directive in /etc/nginx/nginx.conf or a site config in /etc/nginx/sites-enabled/, it will tell you.
Port 80 (HTTP) or 443 (HTTPS) might already be in use by Apache, another nginx instance, or something like Discourse’s built-in web server. Check with:
sudo lsof -i :80
sudo lsof -i :443
If Apache is installed, you’ll need to stop and disable it before nginx can bind:
sudo systemctl stop apache2
sudo systemctl disable apache2
Once you resolve the conflict or config error:
sudo systemctl restart nginx
sudo systemctl status nginx
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.