Adnan Hossain
  • Home
  • Skills
  • Experience
  • Projects
  • Contact
  • Blog
  • Home
  • Skills
  • Experience
  • Projects
  • Contact
Adnan Hossain

I build scalable MERN applications, REST APIs, authentication systems, automation tools, npm packages, and MCP workflows.

adnanhjoy@gmail.comDhaka, Bangladesh

Navigate

  • —Home
  • —Blogs
  • —Privacy Policy
  • —Terms of Service

Connect

  • —GitHub
  • —LinkedIn
  • —Medium
  • —Instagram
  • —npm
  • —X / Twitter
  • —LeetCode
  • —Facebook

Connect Whatsapp

© 2026 Adnan Hossain. All rights reserved.

How to deploy Next.js on AWS EC2 with SSL (HTTPS)

Step 1: Launch ec2 instance

Step 2: Create network inbound roles

Step 3: Create record on route 53 A record for each domain and subdomain

Step 4: Domain configure

Step 5: Open terminal putty or browser

Step 6: Update Sudo Apt

sudo apt update

Step 7: Start to install Node

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

Step 8: Activate nvm

. ~/.nvm/nvm.sh

Step 9: Install Node.js

nvm install node

Step 10: Install Nginx

sudo apt-get install nginx

Step 11: Service nginx status for check version,

nginx -v

Step 12:

systemctl start nginx

Step 13:

systemctl enable nginx

Step 14:

systemctl status nginx

Step 15: Nginx configuration >> /etc/nginx/sites-available/default

server {
        listen 80;
        server_name example.com www.example.com;
        
        location / {
            proxy_pass http://127.0.0.1:3000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }

Step 16: Symbolik link create

sudo nginx -t

Step 17:

sudo systemctl reload nginx

Step 18:

sudo systemctl status nginx

Step 19: To check domain is connected successfully all domain or subdomain

nslookup example.com

Step 20: Install PM2

npm i -g pm2

Step 21: Start for react project

pm2 start npm --name "admin" -- server.cjs

Step 22: Start for next js project

pm2 start npm --name "frontend" -- run start

Step 23: Start for node project

 pm2 start npm --name "backend" -- app.js

Step 24: SSL Enable by certbot

sudo apt install certbot

Step 25:

sudo apt install python3-certbot-nginx

Step 26:

sudo certbot --nginx -d example.com -d www.example.com -d server.example.com -d admin.example.com

Step 27:

sudo certbot renew --dry-run