<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Md. Rakibul Islam on Medium]]></title>
        <description><![CDATA[Stories by Md. Rakibul Islam on Medium]]></description>
        <link>https://medium.com/@rakibutsho?source=rss-f0a573813806------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*F38JqoB6pK4J39AKdHO27g.jpeg</url>
            <title>Stories by Md. Rakibul Islam on Medium</title>
            <link>https://medium.com/@rakibutsho?source=rss-f0a573813806------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 20:18:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rakibutsho/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Day My Node.js App Met the Real World]]></title>
            <link>https://medium.com/@rakibutsho/the-day-my-node-js-app-met-the-real-world-e0115a4a70d9?source=rss-f0a573813806------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0115a4a70d9</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Md. Rakibul Islam]]></dc:creator>
            <pubDate>Sat, 24 Jan 2026 09:20:35 GMT</pubDate>
            <atom:updated>2026-01-24T09:20:35.986Z</atom:updated>
            <content:encoded><![CDATA[<p>A beginner software engineer’s journey into cloud computing, Nginx, and understanding how servers actually work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O86LKlH9kUuYCbinkX3XFA.png" /></figure><p>When I started my career as a software engineer, JavaScript was my world.</p><p>I built UI components using <strong>React</strong> and <strong>Next.js</strong>, connected APIs, and wrote backend functions that worked perfectly — for me — on <strong>localhost</strong>. Everything ran smoothly. No errors. No surprises. Life was comfortable.</p><p>But there was one big thing I didn’t understand.</p><p>I had <strong>no real idea how servers work in the real world</strong>.</p><p>For me, deployment meant clicking “run” and watching the app open in the browser. I didn’t think about where the code lived, how requests reached my application, or what happened when real users tried to access it from somewhere far away.</p><p>At that stage, <em>localhost felt like production</em> — and I didn’t even realize what I was missing.</p><p>Then one day, I had to do something simple (at least it sounded simple): <strong>“Deploy it.”</strong></p><p>Not run it. Not test it.<br>Actually put my Node.js app somewhere that other people could open from their phones, their laptops, from anywhere.</p><p>That’s when I realized I had been living in a safe bubble.</p><p>On localhost, everything is direct:</p><ul><li>I start the server</li><li>I hit <a href="http://localhost:3000/">http://localhost:3000</a></li><li>It works</li></ul><p>But in the real world, there are layers. Real rules. Real traffic. Real risks.</p><p>I started hearing words I used to ignore:</p><p><strong>VPS, SSH, domain, DNS, ports, firewall, Nginx, reverse proxy, SSL…</strong></p><p>At first, it felt overwhelming. Like server deployment was a different profession.</p><p>But then I decided:<br> If I can build the app, I should also understand <strong>how it reaches users</strong>.</p><p>So I stopped running away from server setup — and started learning the basics step by step.</p><p>And that’s exactly what I’m going to share next:<br> <strong>the server setup instructions + the code/config I used</strong> to deploy a Node.js app using <strong>Nginx</strong> like a real production environment.</p><p><strong><em>Step 1: Logging Into a Real Server for the First Time</em></strong></p><p>This was the first moment it felt <em>real</em>.<br>Until now, everything I built lived on my machine. But to deploy my app, I had to enter a different world — a <strong>remote server</strong> sitting somewhere in a data center.</p><p>I opened my terminal and typed:</p><pre>ssh root@your_ip_address</pre><p>This command connects your local machine to the server using <strong>SSH (Secure Shell)</strong>. After running it, the server asked for the password. Once I entered it and pressed <strong>Enter</strong>, something changed.</p><p><strong><em>Step 2: Preparing the Ubuntu Server</em></strong></p><p>My server was running <strong>Ubuntu</strong>, and before installing anything, I learned one important rule:</p><blockquote><em>Always update the server first.</em></blockquote><p>Outdated packages can cause unexpected issues later, so I started by updating everything.</p><pre>sudo apt update<br>sudo apt upgrade</pre><p>This makes sure all system packages are up to date and secure. It’s a small step — but skipping it can create big problems later.</p><p><strong><em>Step 3: Enabling the Firewall (UFW)</em></strong></p><p>Now that the server was updated, security came into the picture. A public server is exposed to the internet, so I enabled <strong>UFW (Uncomplicated Firewall)</strong> to control which ports are allowed.</p><pre>sudo ufw enable</pre><p>Since SSH uses port <strong>22</strong>, I allowed it explicitly — otherwise, I could lock myself out of the server.</p><pre>sudo ufw allow 22</pre><p>To confirm everything was set correctly, I checked the firewall status:</p><pre>sudo ufw status</pre><p>Seeing the firewall active made me feel like I was finally treating this server like a real production machine.</p><p><strong>Step 4: Installing NVM &amp; Node.js</strong></p><p>Next came the heart of the setup — <strong>Node.js</strong>.</p><p>Instead of installing Node directly, I used <strong>NVM (Node Version Manager)</strong>. This gives flexibility to switch Node versions easily.</p><p>First, I installed NVM:</p><pre>curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash</pre><p>Then I loaded it into the current shell:</p><pre>source ~/.bashrc</pre><p>To verify NVM was installed:</p><pre>nvm -v</pre><p>Now I installed Node.js:</p><pre>nvm install --lts<br><br>Or, if a specific version was needed:<br><br>nvm install 18.17.1</pre><p>Finally, I confirmed everything worked:</p><pre>node -v<br>npm -v</pre><p>At this point, my server was no longer empty — it was officially <strong>Node.js ready</strong></p><p><strong><em>Step 5: Connecting the Server to GitHub</em></strong></p><p>To deploy real projects, the server needs access to my code. For that, I connected the server securely to <strong>GitHub using SSH</strong>.</p><p>First, I checked if any SSH keys already existed:</p><pre>ls -al ~/.ssh</pre><p>Then I generated a new SSH key:</p><pre>ssh-keygen -t rsa -b 4096 -C &quot;github@username.com&quot;</pre><p>Next, I started the SSH agent:</p><pre>eval &quot;$(ssh-agent -s)&quot;</pre><p>And printed the public SSH key:</p><pre>cat ~/.ssh/id_rsa.pub</pre><p>I copied this key and added it to <strong>GitHub → Settings → SSH and GPG keys → New SSH key</strong>. I gave it a meaningful name (usually the project or server name) and pasted the key.</p><p>To verify everything worked, I tested the connection:</p><pre>ssh -T git@github.com</pre><p>When I saw the success message, I knew my server could now securely pull code from GitHub — no passwords, no risk.</p><p><strong><em>Step 6: Setting Up Nginx (The Gateway to the Internet)</em></strong></p><p>This is where the server started to feel <em>production-ready</em>.</p><p>Before installing Nginx, I opened the necessary ports:</p><pre>sudo ufw allow 80/tcp<br>sudo ufw allow 3000<br>sudo ufw allow 443/tcp<br>sudo ufw reload</pre><ul><li><strong>PORT 80</strong> → HTTP</li><li><strong>PORT 443</strong> → HTTPS</li><li><strong>PORT 3000</strong> → Node.js app (temporary, for testing)</li></ul><p>Then I installed Nginx:</p><pre>sudo apt install nginx -y</pre><p>I checked its status:</p><pre>sudo systemctl status nginx</pre><p>And made sure it starts automatically on server boot:</p><pre>sudo systemctl start nginx<br>sudo systemctl enable nginx</pre><p>To simplify firewall rules for Nginx, I allowed the full profile:</p><pre>sudo ufw allow &#39;Nginx Full&#39;<br>sudo ufw enable</pre><p>At this moment, the server was officially open to the internet — and Nginx was ready to act as the <strong>reverse proxy</strong> between users and my Node.js app.</p><p><strong><em>Step 7: Configuring Nginx as a Reverse Proxy</em></strong></p><p>My <strong>Node/Next.js apps were running locally on ports</strong> like 3000 or 5008, but users on the internet don’t visit ports like that. They visit a <strong>domain</strong> like:</p><ul><li>yourdomain.com (frontend)</li><li>api.yourdomain.com (backend)</li></ul><p>So the goal of Nginx is simple:</p><p><strong>Nginx receives requests from the internet (port 80/443) and forwards them to the correct app running on localhost ports. </strong>That forwarding is called a <strong>reverse proxy</strong>.</p><p>Frontend (Next.js) with Nginx<br>Created a config file for the frontend like this:</p><p>When I ran this command:</p><pre>sudo nano /etc/nginx/sites-available/yourdomain.com</pre><p>a file opened inside my VPS. At first it looked scary — just an empty screen waiting for text. But this file is actually Nginx’s “rule book.” Whatever I write here tells Nginx:</p><p>For Frontend:</p><pre>server {<br>  listen 80;<br>  server_name yourdomain.com www.yourdomain.com;<br><br>  location / {<br>    proxy_pass http://localhost:3000;  # Next.js runs on port 3000<br>    proxy_http_version 1.1;<br>    proxy_set_header Upgrade $http_upgrade;<br>    proxy_set_header Connection &#39;upgrade&#39;;<br>    proxy_set_header Host $host;<br>    proxy_cache_bypass $http_upgrade;<br>  }<br>}</pre><p>Enable the site:</p><pre>sudo ln -s /etc/nginx/sites-available/yourdomain.com /etc/nginx/sites-enabled</pre><p>For Backend:</p><pre>server {<br>  listen 80;<br>  server_name api.myfinancialtrading.com;<br><br>  location / {<br>    proxy_pass http://localhost:5008(backend port);<br><br>    proxy_set_header Host $host;<br>    proxy_set_header X-Forwarded-Host $host;<br>    proxy_set_header X-Forwarded-Proto $scheme;<br>    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>  }<br>}</pre><p><strong>Repeat the Enable site command</strong></p><p>WebSocket (Real-time apps)</p><pre>sudo nano /etc/nginx/conf.d/file.conf</pre><pre>server {<br>  listen 80;<br>  server_name api.myfinancialtrading.com;<br>  client_max_body_size 1000M;<br><br>  location / {<br>    proxy_pass http://localhost:5008;<br><br>    # WebSocket-specific headers<br>    proxy_http_version 1.1;<br>    proxy_set_header Upgrade $http_upgrade;<br>    proxy_set_header Connection &quot;Upgrade&quot;;<br><br>    # Additional proxy headers<br>    proxy_set_header Host $host;<br>    proxy_set_header X-Forwarded-Host $host;<br>    proxy_set_header X-Forwarded-Proto $scheme;<br>    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br><br>    # Optional: Disable caching for WebSockets<br>    proxy_cache_bypass $http_upgrade;<br>  }<br>}</pre><p>Enable + Test Nginx Configuration<br>After configuring, you enabled and validated:</p><pre>sudo ln -s /etc/nginx/sites-available/api.yourdomain.com /etc/nginx/sites-enabled<br>sudo nginx -t<br>sudo systemctl reload nginx</pre><p>- nginx -t is your safety check. If there’s an error, <strong>don’t reload</strong> yet.<br>- reload applies changes without stopping Nginx.</p><p><strong>Step 8: Installing the Project (Inside </strong><strong>/var/www)</strong></p><p>Before cloning my project, I learned one important convention:</p><p>👉 <strong>Production web projects usually live inside </strong><strong>/var/www</strong></p><p>This directory is commonly used to store websites and server-side applications.<br> Keeping projects here makes the server organized and easier to manage.</p><p>So first, I moved into that directory:</p><pre>cd /var/www</pre><p>Then I cloned my project from GitHub:</p><pre>git clone &lt;your-repository-url&gt;<br>cd &lt;project-folder&gt;</pre><p>Install Dependencies &amp; Build the Project<br>Next, I installed all required dependencies:</p><pre>npm install</pre><p>For frontend apps like <strong>Next.js</strong>, I created a production build:</p><pre>npm run build</pre><p>And tested it once:</p><pre>npm run start</pre><p>Keeping the App Alive with PM2</p><p>If the server restarts or the SSH session closes, a normal npm start process will stop.<br>To solve this, I installed <strong>PM2</strong>, a Node.js process manager:</p><pre>npm install -g pm2<br>pm2 --version</pre><p>Running the Frontend with PM2 (Next.js)</p><pre>pm2 start npm --name &quot;project-frontend&quot; -- start</pre><p>Running the Backend with PM2</p><pre>pm2 start dist/server.js --name bigmama-backend</pre><p>Managing PM2 Processes<br>Check running apps:</p><pre>pm2 list</pre><pre>Restart all apps:<br>pm2 restart all<br><br>Stop an app:<br>pm2 stop nextjs-app<br><br>Delete an app:<br>pm2 delete nextjs-app</pre><p>Auto-Start on Server Reboot (Very Important)</p><pre>pm2 startup<br>pm2 save</pre><p><strong>Step 9: Installing SSL (Turning HTTP into HTTPS)</strong></p><p>Up until this point, my application was live — but there was still one big problem.</p><p>The site was running on <strong>HTTP</strong>, not <strong>HTTPS</strong>.</p><p>Modern browsers warn users when a site isn’t secure, and for production apps, SSL is no longer optional — it’s a <strong>requirement</strong>.</p><p>So the final step was to install <strong>SSL certificates</strong> using <strong>Certbot</strong>.</p><p><strong>Installing Certbot for Nginx</strong><br>First, I installed Certbot and its Nginx plugin:</p><pre>sudo apt install certbot python3-certbot-nginx -y</pre><p>Generating SSL Certificates</p><pre>sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com</pre><p>During the process, Certbot asked a few simple questions (email, agreement, redirect).<br>I chose to <strong>redirect HTTP → HTTPS</strong>, so all traffic stays secure.</p><p>I started my journey building apps on localhost without understanding what happened beyond my screen. Learning server setup, Nginx, and SSL taught me how software actually reaches users.</p><p>If you’re starting your career as a software engineer, don’t stop at writing code — <strong>learn how to deploy it. </strong>That’s where real engineering begins.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0115a4a70d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>