🔧 Programmierung 🕛 vor 1 Jahr 3 Min Lesezeit
0

From Code to the Cloud: A Step-by-Step Guide to Deploying Your Node.js App on AWS EC2 II

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht




From Code to the Cloud:



A Step-by-Step Guide to Deploying Your Node.js App on AWS EC2 II






The part one dealt with the following:




  1. Setting up an AWS account

  2. Creating an EC2 instance

  3. Installing Node.js and NPM

  4. Creating a simple Node.js app

  5. Installing and configuring PM2

  6. Using SSH to connect to your EC2 instance

  7. Deploying your app to the EC2 instance



Read the part one





Install the Nginx reverse proxy



ssh into your EC2 instance




CODE
ssh -i "your.pem" ubuntu@<your-ec2>
sudo su - # to get root access









Install nginx






CODE
sudo apt-get update
sudo apt-get install nginx









check if nginx is installed






CODE
nginx -v  #nginx version: nginx/1.18.0 (Ubuntu)









start nginx






CODE
sudo service nginx start









check if nginx is running






CODE
sudo service nginx status











Installing Core from Snap



This is a snap package that provides the core functionality of snapd and the snap command-line tool. It is required to install other snaps.




CODE
sudo snap install core; 
sudo snap refresh core









Remove Certbot if it's already installed






CODE
sudo apt remove certbot









Install Certbot






CODE
sudo snap install --classic certbot









Create a symbolic link






CODE
sudo ln -s /snap/bin/certbot /usr/bin/certbot






change the following lines to the server block




CODE
server {
listen 80;
server_name mysubdomain.com; # replace with your domain name

location / {
proxy_pass http://localhost:5000; # replace with your app's port
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}









Check status and reload nginx






CODE
sudo nginx -t
sudo systemctl reload nginx









Run Certbot (obtain free ssl)






CODE
sudo certbot certonly --nginx -d mysubdomain.com









Verify certbot renewal






CODE
sudo systemctl status snap.certbot.renew.service






Image description






Enable automatic renewal






CODE
sudo certbot renew --dry-run









Conclusion



By following these steps, you can easily set up a subdomain on your server and obtain a free SSL certificate using Certbot. This will help you secure your website and improve its performance.

Vollständiger Original-Artikel
Den kompletten Beitrag mit allen Details direkt auf dev.to lesen.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
6 Quellen
Create a Coloring Page with ChatGPT | OpenAI Academy
1 Quelle
New Gemini Update Is SCARY GOOD!
1 Quelle
OpenAI Just Revealed Something More Dangerous Than AGI
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten From Code to the Cloud: A Step-by-Step Guide to Deploying Your Node.js App on AWS EC2 II

Thematisch verwandte Begriffe: From, Code, Cloud, StepbyStep · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...