A repo to deploy and secure single server node applications/websites This is made under the assumption that you have a working ip/domain for your website. You are able to run and test these commands local as well as in an ec2 shell.
- the Dockerfile is preset to install the latest version of node and for the app to start with the command
npm start
- You will also need to add this code in your server assuming it is an express server
app.use(express.static(".well-known/acme-challenge/"));
Step 3. Replace <domain> with your ip address or domain for your website in the data/nginx/app.conf
file
curl -L https://raw.githubusercontent.com/wmnnd/nginx-certbot/master/init-letsencrypt.sh > init-letsencrypt.sh
followed by
chmod +x init-letsencrypt.sh
- this command will download a file that will produce the certificate.
- Make sure to review the file so that you can stage your attempts before hitting a rate limit and that it hits the proper domain/ip
sudo ./init-letsencrypt.sh
- You should see Succesfully received certificate in the console. Once you see that message change the staging value in the init-letsencrypt.sh file back to 0 and repeat this step again.
docker-compose up --build -d
- this setup was used with an ubuntu aws ec2 container
scp -r -i yourkeyname.pem ~/path/to/your/project/folder/from/root ec2-user@<ec2-IPv4-publicIp>:~/
- make sure the path to your pem file is accurate.
- make sure to add in your public ip
- This step will securely copy the contents of your project over to the ec2 shell.