Skip to content

Commit 6c10e17

Browse files
committed
added aws server setup
1 parent 7fafbd3 commit 6c10e17

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

server-setup.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,63 @@ server {
5454
```
5555

5656
(note that I have no idea what I'm doing here, this was copied from [this tutorial](https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-for-apache))
57+
58+
59+
## Deploying on AWS (Linux AMI)
60+
To connect to your ec2 instance run (in gitbash):
61+
`ssh -i ./path/to/key.pem ec2-user@xx.xx.xx.xx`
62+
key.pem is the key generated when you create an instance.
63+
xx.xx.xx.xx is the your public ip
64+
65+
Once connnected to ec2 instance install nodejs
66+
Add nodejs yum repo and build tools
67+
68+
`sudo yum install -y gcc-c++ make`
69+
`sudo curl -sL https://rpm.nodesource.com/setup_6.x | sudo -E bash -`
70+
### Installing nodejs
71+
`sudo yum install nodejs`
72+
73+
check version of nodejs and npm
74+
```
75+
node -v
76+
npm -v
77+
```
78+
#### Installing nginx
79+
`sudo yum install nginx`
80+
Now, make the following changes to /etc/nginx/nginx.conf
81+
`sudo vi /etc/nginx/nginx.conf`
82+
```nginx
83+
server {
84+
listen 80;
85+
server_name yourPublicDNS.com;
86+
87+
location ~^.*$ {
88+
proxy_set_header X-Real-IP $remote_addr;
89+
proxy_set_header X-Forwarded-For $remote_addr;
90+
proxy_set_header Host $host;
91+
proxy_pass http://localhost:3000;
92+
}
93+
}
94+
```
95+
#### Start nginx server
96+
```
97+
sudo service nginx start
98+
sudo service nginx status
99+
```
100+
#### Installing micro-analytics-cli
101+
```
102+
npm install micro-analytics-cli -g
103+
micro-analytics
104+
```
105+
##### Important: enable port 80 on your ec2 instance
106+
107+
* Go to aws.amazon.com, Select ec2 and go to running instances
108+
* On left side navigation menu go to Network & Security > Security groups
109+
* click on the instance for which the port is to be enabled.
110+
* click on inbound tab and click edit. Now in the pop up Add Rule and select http
111+
* save
112+
113+
114+
Now visit the public DNS
115+
try to visit some url like www.yourDNS.com/something
116+
If you only specify the public DNS like www.yourDNS.com u will get the message: please include a path to a page

0 commit comments

Comments
 (0)