This project is part of an assessment for a Web Developer Internship at Hermaig Jewellers.
- Primary Demo Link: https://api.asadprime.store
- Alternative Link (if the primary link is inactive): https://harmaig-backend.onrender.com
This document outlines the deployment process for the Express API hosted on AWS.
- Amazon EC2: Virtual server hosting the Express API.
- PM2: Process manager for Node.js applications.
- NGINX: Reverse proxy server to handle requests and SSL.
- Let's Encrypt: Provides SSL certificates for secure connections.
-
Launch EC2 Instance: Set up a
t2.nanoinstance running Ubuntu. -
Install Node.js and NPM:
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt install nodejs -
Clone the Project:
git clone https://github.com/asad2050/e-commerce-backend-aws
-
Install Dependencies and Start App:
sudo npm install pm2 -g cd e-commerce-backend-aws pm2 start index -
Configure NGINX:
- Go to the root directory and execute the following commands:
sudo apt install nginx sudo nano /etc/nginx/sites-available/default
- Add the following to the location part of the server block:
server_name yourdomain.com www.yourdomain.com; location / { proxy_pass http://localhost:8001; # whatever port your app runs on proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; }# Check NGINX config sudo nginx -t # Restart NGINX sudo nginx -s reload
-
Add SSL with Let's Encrypt:
sudo certbot --nginx -d domain.com -d www.domain.com
-
Domain Setup:
- The domain asadprime.store was purchased from Hostinger, where the redirect settings were updated to point to the EC2 instance.
Explore the live Express API using the following links:
- Primary Demo Link: https://api.asadprime.store
- Alternative Link (if the primary link is inactive): https://harmaig-backend.onrender.com
The deployment of the Express API on AWS is complete. For further assistance, feel free to reach out.