Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS + EC2 bare metal cheat sheet / ssl - nginx #259

Open
johndpope opened this issue Sep 16, 2021 · 1 comment
Open

AWS + EC2 bare metal cheat sheet / ssl - nginx #259

johndpope opened this issue Sep 16, 2021 · 1 comment

Comments

@johndpope
Copy link

johndpope commented Sep 16, 2021

I abandoned efforts to use ecs to deploy sample code - but ended up with this solution running nginx.

EC2 - instance micro tier - but must have at least 2Gb RAM to compile apps.

Ensure that AWS EC2 security group
Inbound Rules accept 80 / 443 / 22

sudo yum install git
curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash -
sudo yum install -y nodejs

sudo yum-config-manager --enable epel
 sudo yum update
 sudo yum install inotify-tools
 sudo yum group install "Development Tools"
sudo yum install htop
 cd go 
 ./start.sh


cd quickstart-frontend
npm install
npm run build
npm run strart

# COPY LETS ENCRYPT CERTS
# generate certs here.
https://github.com/single9/docker-wildcard-letsencrypt
sudo mkdir -p  /etc/letsencrypt/
sudo cp -R nginx/letsencrypt  /etc/


sudo yum install nginx
sudo mkdir -p /etc/nginx/conf.d
sudo cp default.conf /etc/nginx/sites-available/default (no .conf)

# Make nginx start on reboot
sudo systemctl enable nginx

sudo systemctl start nginx
sudo systemctl restart nginx
sudo /usr/sbin/nginx -s reload

default.conf

server {
  server_name covershot.app www.covershot.app;
  listen 80;
  listen 443 ssl;

  ssl_certificate /etc/letsencrypt/live/covershot.app/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/covershot.app/privkey.pem;
  # include /etc/letsencrypt/options-ssl-nginx.conf;

  location /api {
    proxy_pass http://0.0.0.0:8000;
    proxy_set_header X_Forwarded_For $remote_addr;
  }
  location / {
    proxy_pass http://0.0.0.0:3000;
    proxy_set_header X_Forwarded_For $remote_addr;
  }

  if ($http_host = covershot.app) {
      return 301 https://www.covershot.app$request_uri;
  }
}

start frontend / npm run start
start go ./start.

working.

@Worldpremier13
Copy link

Start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants