<?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"><channel><title><![CDATA[Diavante Digital Journey]]></title><description><![CDATA[Client oriented solutions about digital project, web development & mobile app best practices as well as trends on all world digital.]]></description><link>https://diavante.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6a5e3e7f90d4916abc72b43c/832f993c-3b0e-4464-832c-2b18a874366f.png</url><title>Diavante Digital Journey</title><link>https://diavante.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Fri, 18 Sep 2026 17:35:18 GMT</lastBuildDate><atom:link href="https://diavante.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Deploying a Next.js Website from Vercel to a VPS: Everything You Need to Know]]></title><description><![CDATA[One of our clients recently asked us to migrate their Next.js website away from Vercel and deploy it on their own VPS.
At first glance, this sounds simple.
After all, Next.js runs on Node.js, right?
I]]></description><link>https://diavante.hashnode.dev/deploying-a-next-js-website-from-vercel-to-a-vps-everything-you-need-to-know</link><guid isPermaLink="true">https://diavante.hashnode.dev/deploying-a-next-js-website-from-vercel-to-a-vps-everything-you-need-to-know</guid><category><![CDATA[Next.js]]></category><category><![CDATA[deployment]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[Linux]]></category><category><![CDATA[Vercel]]></category><dc:creator><![CDATA[Alex]]></dc:creator><pubDate>Mon, 20 Jul 2026 16:05:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6a5e3e7f90d4916abc72b43c/f27f628d-fe62-40d4-b20e-db540e2f59ee.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>One of our clients recently asked us to migrate their <strong>Next.js website away from Vercel</strong> and deploy it on their own VPS.</p>
<p>At first glance, this sounds simple.</p>
<p>After all, Next.js runs on Node.js, right?</p>
<p>In reality, there are quite a few moving parts that people often overlook:</p>
<ul>
<li><p>Which Node version should you install?</p>
</li>
<li><p>Do you need PM2?</p>
</li>
<li><p>What about Nginx?</p>
</li>
<li><p>How do you handle SSL?</p>
</li>
<li><p>Does the project use Static Export or Server Rendering?</p>
</li>
<li><p>How do environment variables work?</p>
</li>
<li><p>What's the deployment workflow after moving away from Vercel?</p>
</li>
</ul>
<p>In this article I'll go through everything we considered during the migration so you can avoid the common mistakes.</p>
<hr />
<h1>Why Move Awayfrom Vercel?</h1>
<p>Don't get me wrong.</p>
<p>Vercel is fantastic.</p>
<p>It's probably still my favourite platform for Next.js projects.</p>
<p>However there are legitimate reasons to move.</p>
<p>For example:</p>
<ul>
<li><p>Company policy requires self-hosting</p>
</li>
<li><p>Existing VPS infrastructure</p>
</li>
<li><p>Lower long-term hosting costs</p>
</li>
<li><p>More control over the server</p>
</li>
<li><p>Security or compliance requirements</p>
</li>
</ul>
<p>In our case the client already managed several VPS servers and wanted all projects under one infrastructure.</p>
<hr />
<h1>First Question: Is Your Site Actually Static?</h1>
<p>This changes everything.</p>
<p>There are generally three scenarios.</p>
<h2>1. Static Export</h2>
<pre><code class="language-plaintext">next export
</code></pre>
<p>or</p>
<pre><code class="language-plaintext">output: 'export'
</code></pre>
<p>These projects can literally be hosted on Nginx without Node running.</p>
<p>Easy.</p>
<hr />
<h2>2. Server Side Rendering</h2>
<p>If you're using:</p>
<ul>
<li><p>getServerSideProps</p>
</li>
<li><p>API routes</p>
</li>
<li><p>authentication</p>
</li>
<li><p>middleware</p>
</li>
</ul>
<p>You'll need Node running continuously.</p>
<hr />
<h2>3. Hybrid</h2>
<p>Most modern Next.js projects fall somewhere in between.</p>
<p>Some pages are static.</p>
<p>Some are rendered dynamically.</p>
<p>This is completely fine you'll just need a Node runtime.</p>
<hr />
<h1>Choosing the VPS</h1>
<p>For most business websites, you don't need a monster server.</p>
<p>Something like:</p>
<ul>
<li><p>2 vCPU</p>
</li>
<li><p>2–4 GB RAM</p>
</li>
<li><p>Ubuntu 24.04 LTS</p>
</li>
<li><p>40–80 GB SSD</p>
</li>
</ul>
<p>is more than enough.</p>
<p>Popular providers include:</p>
<ul>
<li><p>Hetzner</p>
</li>
<li><p>DigitalOcean</p>
</li>
<li><p>Vultr</p>
</li>
<li><p>Linode</p>
</li>
</ul>
<hr />
<h1>Software Stack</h1>
<p>Our deployment stack looked like this:</p>
<pre><code class="language-plaintext">Ubuntu
↓
Node.js LTS
↓
PM2
↓
Nginx
↓
Let's Encrypt SSL
↓
Next.js
</code></pre>
<p>Each tool has a clear responsibility:</p>
<table>
<thead>
<tr>
<th>Tool</th>
<th>Purpose</th>
</tr>
</thead>
<tbody><tr>
<td>Node.js</td>
<td>Runs the application</td>
</tr>
<tr>
<td>PM2</td>
<td>Keeps the app alive and restarts it if needed</td>
</tr>
<tr>
<td>Nginx</td>
<td>Reverse proxy and handles HTTPS</td>
</tr>
<tr>
<td>Certbot</td>
<td>Free SSL certificates</td>
</tr>
</tbody></table>
<hr />
<h1>Environment Variables</h1>
<p>This is one of the easiest things to forget.</p>
<p>Make sure you copy every environment variable from Vercel.</p>
<p>Things like:</p>
<pre><code class="language-plaintext">NEXT_PUBLIC_API_URL
DATABASE_URL
SMTP_PASSWORD
GOOGLE_CLIENT_ID
</code></pre>
<p>Missing even one variable can cause mysterious production bugs.</p>
<hr />
<h1>Build Process</h1>
<p>Once the project is on the server, the deployment is surprisingly straightforward.</p>
<pre><code class="language-plaintext">npm install

npm run build

npm run start
</code></pre>
<p>PM2 then keeps everything running.</p>
<hr />
<h1>Nginx Configuration</h1>
<p>Instead of exposing Node directly, let Nginx handle incoming traffic.</p>
<p>Benefits include:</p>
<ul>
<li><p>SSL termination</p>
</li>
<li><p>Compression</p>
</li>
<li><p>Reverse proxy</p>
</li>
<li><p>Better security</p>
</li>
<li><p>Easier scaling later</p>
</li>
</ul>
<hr />
<h1>SSL</h1>
<p>Never deploy production websites over plain HTTP.</p>
<p>Let's Encrypt makes this almost effortless.</p>
<p>After the initial setup, certificates renew automatically.</p>
<p>One less thing to worry about.</p>
<hr />
<h1>Deployment Workflow</h1>
<p>Instead of Vercel automatically deploying every commit, we implemented a simple deployment flow:</p>
<pre><code class="language-plaintext">Developer
      ↓ 
GitHub
      ↓
SSH into VPS
      ↓
git pull
      ↓
npm install
      ↓
npm run build
      ↓
pm2 restart
</code></pre>
<p>For small teams, this is often all you need.</p>
<p>Larger teams can later automate the process using GitHub Actions.</p>
<hr />
<h1>Things That Caught Us Off Guard</h1>
<p>Every migration teaches you something.</p>
<p>Here are a few things worth checking before switching:</p>
<ul>
<li><p>Node version compatibility</p>
</li>
<li><p>Missing environment variables</p>
</li>
<li><p>File permissions</p>
</li>
<li><p>Build cache</p>
</li>
<li><p>Firewall rules</p>
</li>
<li><p>SSL certificates</p>
</li>
<li><p>Reverse proxy configuration</p>
</li>
<li><p>Process manager restarts</p>
</li>
</ul>
<p>None of these are particularly difficult, but missing just one can turn a 30-minute deployment into hours of debugging.</p>
<hr />
<p>Moving a Next.js project from Vercel to a VPS isn't about replacing one platform with another—it's about understanding the pieces that Vercel quietly manages for you behind the scenes.</p>
<p>Once those responsibilities are handled correctly, self-hosting can be a reliable and flexible option that gives you full control over your infrastructure.</p>
<p>If you're planning a similar migration, spend a little extra time verifying your runtime requirements, environment variables, and deployment workflow before making the switch. It'll save you a lot of headaches later.</p>
<hr />
<h2>About me</h2>
<p>I'm a full-stack developer at <a href="https://www.diavante.com/"><strong>Diavante Digital</strong></a>, where I work on WordPress, WooCommerce, Next.js, automations, APIs, and infrastructure projects. I enjoy documenting real engineering challenges and sharing practical solutions from client work.</p>
]]></content:encoded></item></channel></rss>