How to install Discourse in the AWS EC2 Instances(Ubuntu Server LTS)?

AI-generated summary

A user, Lee533, is seeking help with installing Discourse on an AWS EC2 instance running Ubuntu LTS, while navigating challenges related to DNS, security groups, and Let’s Encrypt certificates. After following the installation guide, Lee533 encountered a “This site can’t be reached” error when trying to access the Discourse site via their FQDN discourse.tricklehub.com. Stephen and schleifer explained that AWS EC2 instances are not publicly accessible by default and that the security group must allow ports 80 and 443. Lee533 confirmed they had not modified the security group settings, which was confirmed by schleifer. The issue was further clarified when Stephen pointed out that DNS configuration was missing—specifically, an A record needed to be set up in NameSilo to point the domain to the EC2 instance’s IP address. Once the DNS was correctly configured and the instance was rebooted, the site loaded successfully, even without running ./launcher rebuild app, which Stephen had previously suggested was necessary for Let’s Encrypt certificate generation. pfaffman confirmed that the certificate renewal is automatic, so no further action is required. Lee533 concluded by confirming that the site now works and that the certificate renewal process is handled automatically.

I am editing a guide on installing Discourse on AWS EC2 Instances (Ubuntu Server LTS) in Simplified Chinese. I am also a beginner in Rails, Linux shell, and Web Development. This is the part I have already edited.
Are there any errors? Thanks.

I especially don’t know want should I do after the part of Edit Discourse Configuration and before Register New Account and Become Admin.

After Edit Discourse Configuration, I can’t visit the hostname of Discourse. What should I do?

EC2 servers aren’t available externally by default, have you configured access?

I checked EC2 support documentation, but I still don’t know how to do that.

If you can SSH to the instance but cannot reach the web site, that suggests your security group is not permitting the necessary ports (80/443) or that nothing is listening on those ports.

Expand on this part.

  • What are you doing?
  • What do you expect to happen?
  • What actually happens?

So you mean I need to change it like this?

The default SG allows all ports. If you are using a custom one, then you will have to permit them like that link shows.

As said above AWS behaves differently to other hosts.

DigitalOcean servers are available over the Internet by default.

AWS servers sit in private networks and aren’t available publicly by default.

You’ve not said anything in the above which suggests you’ve published your EC2 instance or that the FQDN is pointed to the external IP.

So after:

, what do I need to do?

I haven’t changed any Ssettings of EC2 Security Groups.

So how are you expecting traffic on ports 80 or 443 to reach your server?

Access to EC2 instances is denied by default.

Thank you very much. However, due to my limited English reading comprehension and writing skills (I am a 16-year-old Chinese student), I am not sure which post you were replying to.

The screenshot shows “discourse.example.com”. Don’t enter that into the configuration or the browser, it’s just a placeholder for the actual hostname you want.

I know that, In fact I don’t have enter discourse.example.com , it just a example. So, what should I do next?

Have you checked the security group which is applied to the instance?

Did you start the instance with with the AWS web console? Because it will by default run a wizard and attach a custom SG to the instance, usually named something like launch-wizard-1.

What AWS region is it running in?

  1. Yes, I checked it.
  2. Yes.
  3. Asia Pacific (Seoul).

Next level down the stack that could be stopping it would be a firewall. Does iptables -nvL output anything?

Past that is the discourse container actually running? Does it appear in a docker ps?

I entered the command, here is the output:

Chain INPUT (policy ACCEPT 9 packets, 648 bytes)
 pkts bytes target     prot opt in     out     source               destination 

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination 
16012  108M DOCKER-USER  all  --  *      *       0.0.0.0/0            0.0.0.0/0 
16012  108M DOCKER-ISOLATION-STAGE-1  all  --  *      *       0.0.0.0/0            0.0.0.0/0
 7953  107M ACCEPT     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
   86  4460 DOCKER     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0  
 7973  807K ACCEPT     all  --  docker0 !docker0  0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     all  --  docker0 docker0  0.0.0.0/0            0.0.0.0/0 

Chain OUTPUT (policy ACCEPT 8 packets, 600 bytes)
 pkts bytes target     prot opt in     out     source               destination 

Chain DOCKER (1 references)
 pkts bytes target     prot opt in     out     source               destination 
    0     0 ACCEPT     tcp  --  !docker0 docker0  0.0.0.0/0            172.17.0.2           tcp dpt:443
   15   780 ACCEPT     tcp  --  !docker0 docker0  0.0.0.0/0            172.17.0.2           tcp dpt:80

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
 pkts bytes target     prot opt in     out     source               destination 
 7973  807K DOCKER-ISOLATION-STAGE-2  all  --  docker0 !docker0  0.0.0.0/0            0.0.0.0/0
16012  108M RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0   

Chain DOCKER-ISOLATION-STAGE-2 (1 references)
 pkts bytes target     prot opt in     out     source               destination 
    0     0 DROP       all  --  *      docker0  0.0.0.0/0            0.0.0.0/0  
 7973  807K RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0   

Chain DOCKER-USER (1 references)
 pkts bytes target     prot opt in     out     source               destination 
16012  108M RETURN     all  --  *      *       0.0.0.0/0            0.0.0.0/0   
CONTAINER ID        IMAGE                 COMMAND             CREATED             STATUS              PORTS                                      NAMES
1ddff40f95d2        local_discourse/app   "/sbin/boot"        4 minutes ago       Up 4 minutes        0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   app