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

**URL:** https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406
**Category:** Self-hosting
**Created:** [March 23, 2019, 12:33pm UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406 "2019-03-23T12:33:34Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Lee533](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lee533/32/134468_2.png) [@Lee533](https://meta.discourse.org/u/Lee533)
#### Post date: [March 23, 2019, 12:33pm UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/1 "2019-03-23T12:33:34Z")

</div>

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](https://discussions.tricklehub.com/t/topic/24?u=lee) is the part I have already edited.  
Are there any errors? Thanks.

---

<div class="post-metadata">

### Author: ![Lee533](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lee533/32/134468_2.png) [@Lee533](https://meta.discourse.org/u/Lee533)
#### Post date: [March 23, 2019, 12:40pm UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/2 "2019-03-23T12:40:05Z")

</div>

I especially don’t know want should I do after the part of [`Edit Discourse Configuration`](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md) and before [`Register New Account and Become Admin`](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md#register-new-account-and-become-admin).

---

<div class="post-metadata">

### Author: ![Lee533](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lee533/32/134468_2.png) [@Lee533](https://meta.discourse.org/u/Lee533)
#### Post date: [March 23, 2019, 12:57pm UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/3 "2019-03-23T12:57:42Z")

</div>

> [@Lee533](#):
>
> the part of [`Edit Discourse Configuration`](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md) and before [`Register New Account and Become Admin`](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md#register-new-account-and-become-admin)

After [`Edit Discourse Configuration`](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md), I can’t visit the hostname of Discourse. What should I do?

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [March 23, 2019, 1:12pm UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/4 "2019-03-23T13:12:06Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Lee533](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lee533/32/134468_2.png) [@Lee533](https://meta.discourse.org/u/Lee533)
#### Post date: [March 23, 2019, 2:05pm UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/5 "2019-03-23T14:05:06Z")

</div>

> [@Stephen](#):
>
> have you configured access?

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

---

<div class="post-metadata">

### Author: ![schleifer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schleifer/32/86416_2.png) [@schleifer](https://meta.discourse.org/u/schleifer)
#### Post date: [March 23, 2019, 5:43pm UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/6 "2019-03-23T17:43:39Z")

</div>

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.

> [@Lee533](#):
>
> can’t visit the hostname of Discourse

Expand on this part.

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

---

<div class="post-metadata">

### Author: ![Lee533](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lee533/32/134468_2.png) [@Lee533](https://meta.discourse.org/u/Lee533)
#### Post date: [March 24, 2019, 1:03am UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/7 "2019-03-24T01:03:33Z")

</div>

> [@schleifer](#):
>
> that suggests your security group is not permitting the necessary ports (80/443)

So you mean I need to change it like [this](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-rules-reference.html#sg-rules-web-server)?

---

<div class="post-metadata">

### Author: ![schleifer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schleifer/32/86416_2.png) [@schleifer](https://meta.discourse.org/u/schleifer)
#### Post date: [March 24, 2019, 3:55am UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/8 "2019-03-24T03:55:05Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Lee533](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lee533/32/134468_2.png) [@Lee533](https://meta.discourse.org/u/Lee533)
#### Post date: [March 24, 2019, 6:17am UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/9 "2019-03-24T06:17:26Z")

</div>

- What are you doing?  
I have already bought a domain(and without change any settings), registered a AWS account, and launch a Instance, [connected to the Instance from Windows using PuTTY](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html), follow [Set up Discourse in the cloud in under 30 minutes](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md) from [`Install Docker / Git`](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md#install-docker--git) step and finished [`Edit Discourse Configuration`](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md#edit-discourse-configuration).

- What do you expect to happen?  
Continue to follow [Set up Discourse in the cloud in under 30 minutes](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md)‘ [`Start Discourse`](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md#start-discourse) step.

- What actually happens?  
Page displayed `This site can’t be reached`

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [March 24, 2019, 7:21am UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/10 "2019-03-24T07:21:45Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Lee533](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lee533/32/134468_2.png) [@Lee533](https://meta.discourse.org/u/Lee533)
#### Post date: [March 24, 2019, 9:50am UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/12 "2019-03-24T09:50:29Z")

</div>

So after:

> [@Lee533](#):
>
> change it like [this](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-rules-reference.html#sg-rules-web-server)

, what do I need to do?

---

<div class="post-metadata">

### Author: ![Lee533](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lee533/32/134468_2.png) [@Lee533](https://meta.discourse.org/u/Lee533)
#### Post date: [March 24, 2019, 10:47pm UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/13 "2019-03-24T22:47:19Z")

</div>

> [@schleifer](#):
>
> If you are using a custom one, then you will have to permit them like that link shows.

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

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [March 24, 2019, 10:56pm UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/14 "2019-03-24T22:56:22Z")

</div>

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

Access to EC2 instances is denied by default.

---

<div class="post-metadata">

### Author: ![Lee533](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lee533/32/134468_2.png) [@Lee533](https://meta.discourse.org/u/Lee533)
#### Post date: [March 24, 2019, 11:20pm UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/15 "2019-03-24T23:20:18Z")

</div>

> [@Stephen](#):
>
> So how are you expecting traffic on ports 80 or 443 to reach your server?

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.

---

<div class="post-metadata">

### Author: ![schleifer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schleifer/32/86416_2.png) [@schleifer](https://meta.discourse.org/u/schleifer)
#### Post date: [March 25, 2019, 12:38am UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/16 "2019-03-25T00:38:38Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Lee533](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lee533/32/134468_2.png) [@Lee533](https://meta.discourse.org/u/Lee533)
#### Post date: [March 25, 2019, 4:07am UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/19 "2019-03-25T04:07:40Z")

</div>

I know that, In fact I don’t have enter [`discourse.example.com`](http://discourse.example.com/), it just a example. So, what should I do next?

---

<div class="post-metadata">

### Author: ![schleifer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schleifer/32/86416_2.png) [@schleifer](https://meta.discourse.org/u/schleifer)
#### Post date: [March 25, 2019, 12:40pm UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/20 "2019-03-25T12:40:56Z")

</div>

> [@Lee533](#):
>
> I haven’t changed any Ssettings of EC2 Security Groups.

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?

---

<div class="post-metadata">

### Author: ![Lee533](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lee533/32/134468_2.png) [@Lee533](https://meta.discourse.org/u/Lee533)
#### Post date: [March 25, 2019, 11:24pm UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/22 "2019-03-25T23:24:23Z")

</div>

1. Yes, I checked it.  
 ![EC2 Security Groups](https://global.discourse-cdn.com/meta/original/3X/2/f/2f161d63355b86f65f88f939c067d600790e6b27.png)
2. Yes.
3. Asia Pacific (Seoul).

---

<div class="post-metadata">

### Author: ![schleifer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schleifer/32/86416_2.png) [@schleifer](https://meta.discourse.org/u/schleifer)
#### Post date: [March 26, 2019, 1:00am UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/23 "2019-03-26T01:00:00Z")

</div>

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`?

---

<div class="post-metadata">

### Author: ![Lee533](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lee533/32/134468_2.png) [@Lee533](https://meta.discourse.org/u/Lee533)
#### Post date: [March 26, 2019, 5:59am UTC](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406/26 "2019-03-26T05:59:32Z")

</div>

I entered the command, here is the output:

> [@schleifer](#):
>
> `iptables -nvL` 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   

```

> [@schleifer](#):
>
> docker ps

```
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

```

[Next page](https://meta.discourse.org/t/how-to-install-discourse-in-the-aws-ec2-instances-ubuntu-server-lts/112406.md?page=2)
