mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
1.2 KiB
1.2 KiB
icon |
---|
LogoPM2 |
PM2
How to deploy Nuxt to a Node.js hosting using PM2.
::list
- Support for ultra-minimal SSR build
- Zero-millisecond cold start
- More configuration required ::
Setup
Make sure another preset isn't set in nuxt.config
.
export default {
nitro: {
// this is the default preset so you can also just omit it entirely
// preset: 'node-server'
}
}
Deployment
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 is within the server
subdirectory.
This .output
folder can be deployed to your Node.js host and the server can be run using pm2
.
To start the server in production mode, run:
node .output/server/index.mjs
For example, using pm2
:
module.exports = {
apps: [
{
name: 'NuxtAppName',
exec_mode: 'cluster',
instances: 'max',
script: './.output/server/index.mjs'
}
]
}
More information
See more information on the server preset.