Todos los artículos

migration

How to migrate a Netlify site to a VPS

Move a Netlify site to your own server without losing domains, HTTPS, redirects, or the parts Netlify was quietly handling for you.

  • migration
  • netlify
  • hosting
An abstract migration arrow carries DNS, HTTPS, and redirects from a Netlify card to a VPS server stack.

You want to move off Netlify, but you do not want your site to disappear the moment you touch DNS.

Short version: to move Netlify to your own server, you need to copy the built site or app, recreate anything Netlify was doing for you, point the domain at the new server, and only then switch traffic. The easy part is moving files; the risky part is remembering hidden Netlify features like Netlify Functions, Netlify Forms, _redirects, environment variables, and HTTPS.

What changes when you move Netlify to your own server?

Netlify is not just a place that stores your website. It is more like a quiet shop assistant: it builds your site, puts the finished pages on a shelf, answers visitors, handles HTTPS, reads redirect rules, and sometimes runs small pieces of backend code.

When you move to your own server, you become responsible for those jobs. That does not mean the move is hard, but it does mean you need a checklist.

A simple static site is like moving a stack of printed flyers. You build it, copy the finished folder, and serve it.

A site with forms, functions, redirects, or private environment variables is more like moving a cafe. The tables are not enough. You also need the till, the menu rules, the staff notes, and the keys.

What do you need before you migrate?

Start with the boring pieces, because they are the ones that break launches.

You need a server sized for the site, a domain you can edit, HTTPS for the final domain, and a clear idea of how the site is built. If you are not sure how big the server should be, start small and watch real usage rather than guessing wildly.

You also need to know the output folder. For many static site generators, that is a folder such as dist, build, public, or out. A static site generator is a tool that turns source files into plain HTML, CSS, and JavaScript your browser can read.

Before changing DNS, check these Netlify-specific items:

  • Are you using Netlify Functions?
  • Are you using Netlify Forms?
  • Do you have _redirects or netlify.toml rules?
  • Are there environment variables in Netlify?
  • Are any domains, subdomains, or preview deploys still needed?

If the domain move is new to you, this plain guide on how to point a domain at your server explains the shape of the job without turning DNS into fog.

How do you move a simple static Netlify site?

For a plain static site, the migration path is straightforward.

First, build the site the same way Netlify does. The goal is to produce the final folder visitors should see. If the build fails locally, do not ignore it. Netlify may have environment variables or build settings you forgot about.

Next, put that finished folder on the server and connect it to your domain. Think of the server as the new shopfront and the build folder as the stock on the shelves. If the server points at the wrong folder, visitors may see 404 Not Found even though the files are technically there.

Then set up HTTPS. A working site with a broken certificate looks unsafe to visitors and browsers will shout about it. If you want the plain-English version, read how to get free HTTPS on your own server.

Finally, test before switching the real domain. Check the homepage, deep pages, images, scripts, contact links, and any route that used to rely on Netlify redirects.

What if Netlify features are doing extra work?

This is where most messy migrations happen. The homepage moves, but something invisible breaks.

Netlify Functions are small backend endpoints. On your own server, they need a new home. Sometimes that means running a small app beside the static site. Sometimes it means replacing the function with a separate service.

Netlify Forms do not automatically come with you. If your contact form depended on Netlify collecting submissions, you need another form handler, email path, or small backend. Otherwise the page may look fine while messages vanish.

Redirects also need attention. Netlify understands _redirects and parts of netlify.toml. Your server will not magically read those rules unless you recreate them in the new setup. Miss this and old links may turn into 404 Not Found, or single-page apps may fail when someone refreshes a deep URL.

Environment variables are another common trap. They are private values like API keys or project IDs. If the new server does not have the same values available to the app, the site may build incorrectly or return 502 Bad Gateway when a backend process crashes.

For a small app rather than a pure static site, this guide on how to deploy a web app without DevOps is a useful companion.

The shortcut

Server Manager helps by keeping the move visible instead of turning it into a pile of half-remembered server changes. The outcome you want is simple: the right domain points to the right site, HTTPS is in place, and the setup still makes sense when you come back months later.

That matters for the exact failure modes in this migration: a domain still pointing at Netlify, a wrong or expired certificate, redirects that were forgotten, one project breaking another, or an app failing because its environment values were not accounted for.

The real benefit is that the finished setup stays legible. You can see what belongs to this site, what the domain is meant to serve, and what needs attention later, instead of relying on memory from the day you migrated.

FAQ

Can I move a Netlify site without rebuilding it?

Sometimes. If you have the final built files, you can serve those, but rebuilding from source is safer because it proves you can reproduce the site.

Will my Netlify redirects work automatically?

No. Rules from _redirects or netlify.toml need to be recreated for the new server environment.

Why do I get 404 Not Found after the move?

Usually the server is pointing at the wrong build folder, a deep route is missing redirect support, or DNS is still sending you somewhere unexpected.

Why do I get 502 Bad Gateway after the move?

That usually means a backend app or function is not running correctly, often because of missing environment variables or a failed startup.

Should I delete the Netlify site right away?

No. Keep it until the new server is tested, the domain has switched, HTTPS works, and forms or functions have been checked.

A clean migration is not about rushing away from Netlify. It is about knowing what Netlify was doing, replacing only the parts you need, and switching the domain after the new home is ready.

Do that, and you get the win you came for: your site runs on your own server, the important pieces still work, and you are not left guessing why a page, form, certificate, or redirect broke.