How to deploy Nuxt to your own VPS.
A built Nuxt app is a Node.js server in the .output folder. To run it on a VPS you need Node.js, a service that keeps it running, Nginx in front for HTTPS, and a way to switch versions without dropping requests. ServerDog sets that up from your Mac and deploys each commit as a new release. It can also generate a static Nuxt site and serve it with Nginx alone.
By ServerDog. Updated .
Key facts
- ServerDog’s Nuxt preset builds with npm run build and starts the app with node .output/server/index.mjs.
- The app runs as a systemd service on Node.js 24 LTS, behind Nginx, which handles HTTPS with a Let’s Encrypt certificate.
- ServerDog sets PORT, HOST and NODE_ENV=production, and loads the site’s .env each time the app starts.
- With the Static runtime the build command is npm run generate and Nginx serves .output/public, with no Node process.
- Node deploys are always zero-downtime: the new release starts on a second port, and Nginx switches to it only after it answers.
Before you start
- A Mac running macOS 15 or later, with ServerDog installed.
- A Hetzner, DigitalOcean or Vultr account, or a fresh Ubuntu 24.04 or 26.04 server from any provider.
- Your Nuxt app in a GitHub, GitLab or Bitbucket repository.
- A domain whose DNS you can change.
Node server or static site?
The Nuxt preset can deploy either. You choose the runtime when you create the site.
| Runtime | Build command | Start command | What serves the site |
|---|---|---|---|
| Node server | npm run build |
node .output/server/index.mjs |
A systemd service behind Nginx |
| Static | npm run generate |
None | Nginx serves .output/public |
Choose Node for server-side rendering, server routes and anything else that runs per request. Choose Static when every page can be generated at build time. The steps below are for the Node runtime; the static one skips the service and the second port.
1. Set up the server
Choose Add Server and pick App server or Web server. Both install Node.js 24 LTS by default, along with Nginx and the firewall. A Web server skips the database and cache, which suits a Nuxt app that keeps its data elsewhere.
2. Create the site
Choose New Site and the Nuxt preset. Type the domain, pick npm, pnpm or Yarn, and add the repository URL and branch. The site gets its own read-only deploy key, created on the server.
The preset fills in defaults you can edit:
- Install:
npm ci - Build:
npm run build - Start:
node .output/server/index.mjs
3. Set the environment
Add your variables in the site’s Environment tab. A built Nuxt server does not read .env by
itself, so ServerDog’s start script loads the file before it starts the app. Variables with the NUXT_ prefix
override the matching keys of your runtimeConfig.
ServerDog sets PORT, HOST and NODE_ENV=production for you. The file is shared
across releases and readable only by the site’s user.
4. Deploy
Press Deploy. For a Node site, every deploy is zero-downtime:
- ServerDog checks out the commit into a new release folder, installs dependencies and builds.
- It starts the new release on the site’s second port. Each site has two local ports for this.
- It waits up to a minute for the new release to answer.
- It points Nginx at the new release and reloads Nginx.
- Ten seconds later it stops the old instance.
If the new release never answers, the site keeps serving the previous one. Read how zero-downtime deploys work.
5. Point the domain and turn on HTTPS
Create a DNS record for your domain that points at the server’s IP address. ServerDog waits for DNS, requests a free Let’s Encrypt certificate and shows how long it is valid. The server renews it from then on.
6. Turn on Deploy on Push
In the site’s deploy settings, turn on Deploy on Push. The server checks the repository itself and deploys your branch within a minute of each new commit. There is no webhook to set up, and your Mac doesn’t need to be on.
What you end up with
A plain Ubuntu server running Nginx and Node.js 24, with your Nuxt app as a systemd service behind it and served over HTTPS. There are no containers and no process manager to install: remove the server from ServerDog and it keeps running exactly as it is.
Go deeper
Questions
Can I host Nuxt on my own VPS?
Yes. A built Nuxt app is a Node.js server in the .output folder, so it runs anywhere Node.js does. On a VPS you need Node.js, a service that keeps the server running, and Nginx in front for HTTPS. ServerDog sets up all three and deploys from your Git repository.
How do I run Nuxt in production without PM2?
Run it as a systemd service. ServerDog starts node .output/server/index.mjs as a service that runs as the site’s user and restarts whenever it stops, with Nginx passing requests to it on a local port.
Does a built Nuxt app read my .env file?
Not by itself: a built Nuxt server reads environment variables from the process. ServerDog’s start script loads the site’s .env before it starts the app, so NUXT_ variables in the Environment tab reach your runtime config.
Can ServerDog deploy a static Nuxt site?
Yes. Choose the Static runtime and the build command becomes npm run generate. Nginx then serves the .output/public folder directly, with no Node process to keep running.
Are Nuxt deploys zero-downtime?
Yes. Each deploy builds a new release, starts it on a second local port and waits up to a minute for it to answer. Then Nginx switches to it and the old instance stops ten seconds later. If the new release never answers, the site keeps serving the previous one.
Which Node.js version does ServerDog use for Nuxt?
Node.js 24 LTS, one version per server. There is no per-site Node version. You can pick npm, pnpm or Yarn as the package manager when you create the site.
Last updated by ServerDog.