2021-10-11 16:35:02 +00:00
---
icon: LogoPM2
---
2021-06-14 12:31:30 +00:00
# PM2
2021-10-11 17:18:38 +00:00
How to deploy Nuxt to a Node.js hosting using PM2.
2021-06-14 12:31:30 +00:00
2021-10-11 16:35:02 +00:00
::list
2021-10-29 11:26:01 +00:00
2021-07-15 09:38:06 +00:00
- Support for ultra-minimal SSR build
- Zero millisecond cold start
- More configuration required
2021-10-11 16:35:02 +00:00
::
2021-06-14 12:31:30 +00:00
## Setup
Make sure another preset isn't set in `nuxt.config` .
2021-10-29 11:26:01 +00:00
```js [nuxt.config.js|ts]
2021-06-14 12:31:30 +00:00
export default {
nitro: {
// this is the default preset so you can also just omit it entirely
2022-04-07 11:28:04 +00:00
// preset: 'node-server'
2021-06-14 12:31:30 +00:00
}
}
```
## Deployment
2021-11-21 12:31:44 +00:00
After running `yarn build` , all the required files are located in the `.output` folder. Static assets are in the `public` subdirectory and the server with its dependencies are within the `server` subdirectory.
2021-06-14 12:31:30 +00:00
2022-01-05 18:08:26 +00:00
This `.output` folder can be deployed to your Node.js host and the server can be run using [`pm2` ](https://pm2.keymetrics.io/docs/usage/quick-start/ ).
2021-06-14 12:31:30 +00:00
To start the server in production mode, run:
```bash
2021-07-15 09:38:06 +00:00
node .output/server/index.mjs
2021-06-14 12:31:30 +00:00
```
For example, using `pm2` :
```js [ecosystem.config.js]
module.exports = {
apps: [
{
name: 'NuxtAppName',
exec_mode: 'cluster',
instances: 'max',
2021-11-05 15:37:32 +00:00
script: './.output/server/index.mjs'
2021-06-14 12:31:30 +00:00
}
]
}
```
## More information
2022-04-06 05:56:08 +00:00
See more information on the [server preset ](/guide/deployment/presets/server ).