(Re)Starting Devops
A while back, I had started my DevOps journey with great enthusiasm. But like many of us, life threw in other commitments, and I had to pause that path midway.
Fast forward to today — I’m finally restarting, and the excitement feels fresh again. This time, I’m more determined to be consistent and share my learnings along the way. Today marked Day 2 of my journey, and it was quite an insightful one.
Learning About EC2
I began the day by diving deeper into Amazon EC2 (Elastic Compute Cloud).
EC2 is essentially a virtual server in the cloud where you can host and run your applications. What stood out to me:
You get full control of the server.
You can choose your OS (I went with Ubuntu).
It scales based on demand.
And yes, it’s pay-as-you-go, which makes it beginner-friendly.
Deploying a Next.js App on EC2
Next up was deployment. I wanted to get a simple Next.js app running on my instance. Here’s what I did:
SSH into the EC2 instance
ssh -i "my-key.pem" ubuntu@<ec2-public-ip>Installed Node using NVM
I didn’t want to mess with versions, so NVM made life easier.curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash source ~/.bashrc nvm install 18Pulled in my Next.js project
git clone <your-repo-url> cd project npm install npm run buildKept it running with PM2
npm install -g pm2 pm2 start npm --name "next-app" -- run start pm2 save pm2 startupAt this point, my app was running on port
3000inside the server. But of course, no one’s going to type<ip>:3000forever. That’s where Nginx came in.
Setting Up Nginx Reverse Proxy
I installed Nginx and used it as a reverse proxy so that my app runs directly on port 80 (normal HTTP).
Installed Nginx
sudo apt update sudo apt install nginxConfigured reverse proxy
Edited the config:
server { listen 80; server_name <your-ec2-ip-or-domain>; location / { proxy_pass http://localhost:3000; 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; } }Restarted Nginx
sudo systemctl restart nginxBoom 💥 — app was live on EC2, no port nonsense.
My Takeaways from Day 2
EC2 is simple to get started with, but powerful enough to host almost anything.
NVM saved me from Node version hell.
PM2 is a lifesaver — no need to keep a terminal open to run my app.
Nginx felt magical once the reverse proxy worked.



